mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08: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:
parent
946b5f161e
commit
7cb009cd38
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user