Created
October 30, 2022 18:44
-
-
Save JaKXz/f2e871f19af3595335bca95ca976ed40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/mdx-mermaid/lib/mdxast-mermaid.cjs b/node_modules/mdx-mermaid/lib/mdxast-mermaid.cjs | |
index f7f8c27..ab57d4e 100644 | |
--- a/node_modules/mdx-mermaid/lib/mdxast-mermaid.cjs | |
+++ b/node_modules/mdx-mermaid/lib/mdxast-mermaid.cjs | |
@@ -53,6 +53,7 @@ const createMermaidNode = (node, hName, config) => { | |
data: { | |
hName, | |
hProperties: { | |
+ class: 'mermaid', | |
config: JSON.stringify(config), | |
chart: node.value, | |
}, | |
@@ -60,7 +61,7 @@ const createMermaidNode = (node, hName, config) => { | |
}]; | |
}; | |
const outputAST = async (node, index, parent, config) => { | |
- return createMermaidNode(node, 'mermaid', config); | |
+ return createMermaidNode(node, 'Mermaid', config); | |
}; | |
/* istanbul ignore next */ | |
const outputSVG = async (node, index, parent, config) => { | |
@@ -122,14 +123,15 @@ const outputSVG = async (node, index, parent, config) => { | |
function plugin(config) { | |
// Determine which format to output in | |
let output = outputAST; | |
- /* istanbul ignore next */ | |
+ /* disable raw svg generation | |
if (config?.output === 'svg') { | |
output = outputSVG; | |
} | |
+ */ | |
return async function transformer(ast) { | |
// Find all the mermaid diagram code blocks. i.e. ```mermaid | |
const instances = []; | |
- unistUtilVisit.visit(ast, { type: 'code', lang: 'mermaid' }, (node, index, parent) => { | |
+ unistUtilVisit(ast, { type: 'code', lang: 'mermaid' }, (node, index, parent) => { | |
instances.push([node, index, parent]); | |
}); | |
// Replace each Mermaid code block with the Mermaid component |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment