1

Mermaid allows us to draft and edit diagrams in markdown-styled code, and Draw.io (or Diagrams.net) is able to import Mermaid script, which is however treated as a standalone object after import. The Mermaid script can be modified, but the components of the Mermaid diagram cannot be broken down to be edited individually in Draw.io.

Would that be possible if the Mermaid script could be converted and imported as XML(mxGraphModel), or via any other formats?
It would be convenient to load existing Mermaid diagram and then tailor it in Draw.io for more dedicated diagramming needs.

Similar idea has been suggested in mermaidjs/mermaid.cli, and I am seeking if there are any existing tool or solution for this.

1
  • Im not sure if I completely understand which part you want to be as XML. Can you provide a sample of what the resulting XML might look like? Commented Mar 21, 2023 at 16:58

2 Answers 2

0

Looks to me like a job for Invisible XML, which basically allows you to convert anything to XML if you can write a BNF grammar for it. However, writing a BNF grammar for Mermaid looks a little bit tricky because it seems to be very informally specified - the section on syntax seems to give lots of examples but no actual grammar, unless I missed something.

Once you've got it in XML, of course, it's easy to convert it do DotML using XSLT, and then you've got the power of GraphViz at your fingertips. Or you could convert it to anything else that has an XML representation.

Sign up to request clarification or add additional context in comments.

Comments

0

I had 2 tools I wrote that could help with this.

I wrote an npm cli https://github.com/Software-Developers-IRL/Little-Mermaid-2-The-SQL that can convert mermaid erDiagrams into a sql export.

Then you can use my updated sql plugin for drawio https://github.com/funktechno/sqltooling-drawio to import sql into drawio uml models.

Code is opensourced so there are alternative ways if you want to customize.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.