Exposing Data Structure for Generating SVG in mermaid.render #5529
perseveringman
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I encountered a requirement while using the mermaid project and I hope this can be considered for future updates.
When using the mermaid.render function to render charts as SVG, I noticed that we can only access the rendered SVG data. However, for some advanced use cases, such as needing to further process or analyze the generated charts, it would be very useful to have access to the underlying data structure that generates this SVG.
I suggest that in the return value of the mermaid.render function, it should not only include the current SVG string but also include an object or JSON that describes the data structure behind this SVG chart.
Here is an example of the expected return value format:
mermaid.render('graph TD; A-->B; B-->C', function(svgCode, dataStructure) { console.log(svgCode); // Current SVG string as supported console.log(dataStructure); // New: Data structure behind the chart });
This feature can help developers interact better with the generated charts, for example:
Easily extract information about nodes and edges.
Analyze and transform the chart structure.
Create other output formats based on the data structure when there is no graphical interface.
I am very interested in this feature and would be happy to help implement it.
Thank you for considering this, and I look forward to seeing this feature implemented.
Beta Was this translation helpful? Give feedback.
All reactions