mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-23 17:29:54 +02:00
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:
@@ -420,7 +420,7 @@ async function transormJsonSchema(file: string) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const transformed = remark()
|
const transformer = remark()
|
||||||
.use(remarkGfm)
|
.use(remarkGfm)
|
||||||
.use(remarkFrontmatter, ['yaml']) // support YAML front-matter in Markdown
|
.use(remarkFrontmatter, ['yaml']) // support YAML front-matter in Markdown
|
||||||
.use(transformMarkdownAst, {
|
.use(transformMarkdownAst, {
|
||||||
@@ -428,8 +428,9 @@ async function transormJsonSchema(file: string) {
|
|||||||
originalFilename: file,
|
originalFilename: file,
|
||||||
addAutogeneratedWarning: !noHeader,
|
addAutogeneratedWarning: !noHeader,
|
||||||
removeYAML: !noHeader,
|
removeYAML: !noHeader,
|
||||||
})
|
});
|
||||||
.stringify(markdownAst as Root);
|
|
||||||
|
const transformed = transformer.stringify(await transformer.run(markdownAst as Root));
|
||||||
|
|
||||||
const formatted = prettier.format(transformed, {
|
const formatted = prettier.format(transformed, {
|
||||||
parser: 'markdown',
|
parser: 'markdown',
|
||||||
|
Reference in New Issue
Block a user