build(docs): run remark plugins on MermaidConfig

We use the `unified.stringify()` function on our remark plugins to
stringify the Markdown AST for our MermaidConfig documentation.
However, [`.stringify()`][1] only runs the stringify phase in unified,
not the "run" phase. If we want to run our plugins on the Markdown AST,
we need to also use the [`.run()`][2] function.

[1]: https://github.com/unifiedjs/unified#processorstringifytree-file
[2]: https://github.com/unifiedjs/unified#processorruntree-file-done
This commit is contained in:
Alois Klink 2023-07-13 23:54:49 +01:00
parent 946b5f161e
commit 7cb009cd38
1 changed files with 4 additions and 3 deletions

View File

@ -420,7 +420,7 @@ async function transormJsonSchema(file: string) {
}
});
const transformed = remark()
const transformer = remark()
.use(remarkGfm)
.use(remarkFrontmatter, ['yaml']) // support YAML front-matter in Markdown
.use(transformMarkdownAst, {
@ -428,8 +428,9 @@ async function transormJsonSchema(file: string) {
originalFilename: file,
addAutogeneratedWarning: !noHeader,
removeYAML: !noHeader,
})
.stringify(markdownAst as Root);
});
const transformed = transformer.stringify(await transformer.run(markdownAst as Root));
const formatted = prettier.format(transformed, {
parser: 'markdown',