Open bschlenk opened 2 years ago
The data is stored in in a diagram specific representation after parsing. I would not that difficlt to dump it to some other format like JSON but there is no built in functionality for that.
+1 for support for dumping or otherwise exposing access to the AST, in the Mermaid API.
Over a year has passed; are there any updates to this issue? 👀
I want to create a tool using the Mermaid API and get the AST, but it looks like it's not currently possible.
https://stackblitz.com/edit/node-5crpy6?file=index.mjs&view=editor
It's actually there. Curious no one answers.
https://stackblitz.com/edit/node-5crpy6?file=index.mjs&view=editor
It's actually there. Curious no one answers.
Each diagram has its own database, but it doesn't show any internal stuff. For example, in your given code, it doesn't show where each node has been declared, its start and end, or how each node has been declared; much more depends on each diagram.
https://stackblitz.com/edit/node-5crpy6?file=index.mjs&view=editor
It's actually there. Curious no one answers.
Thank you. It looks like a real possibility of working with JSON, and making changes easier.
But it's not well documented. The main function used getDiagramFromText
has only a mention, but the output time and so on are not clear.
Probably updating docs, can be the solution for this problem.
https://stackblitz.com/edit/node-5crpy6?file=index.mjs&view=editor
It's actually there. Curious no one answers.
Quick note for future readers, this solution works but depending on your input it requires you to callawait mermaid.parse(mermaidGraph);
before calling getDiagramFromText
, the reason for this being that the parse
function actually resets the internal configApi and adds the processed config to it's directive.
Is there a way to parse mermaid text into an AST? I want to render mermaid diagrams in an environment that uses its own elements, not svg. I believe having an AST representation would make this easier as I could walk through it and draw out the diagram myself.