Write a diagram as text and watch it render as you type — flowcharts, sequence diagrams, state diagrams, Gantt charts and 18 more types — then export it as SVG, PNG or PDF. It works like the Mermaid Live Editor: code on one side, the drawing on the other, and a link that carries the diagram.
Describing a diagram in text means it can live in version control next to the code it documents, and be edited without a drawing program.
- What syntax is this?
- Mermaid, the same text-diagram language GitHub, GitLab and many documentation tools render natively. A diagram you build here can be pasted straight into a README as a mermaid code block.
- What does graph TD mean in Mermaid?
- It is the first line of a flowchart:
graph (or the newer word flowchart) says what kind of diagram follows, and TD says it runs top down. LR runs left to right, BT bottom to top and RL right to left; TB is the same as TD. The Direction menu above the editor changes it for you. - Is there a difference between graph and flowchart?
- For most diagrams, no: both draw the same flowchart.
flowchart is the newer keyword and unlocks a few extras, such as the newer node shapes and the arrows with circle or cross ends, so use it for new diagrams. Old diagrams that start with graph keep working. - Why write a diagram instead of drawing one?
- Because text goes in version control. A Mermaid diagram diffs like code, and changing one box is an edit rather than a fight with a drawing program.
- Should I export SVG, PNG or PDF?
- SVG stays sharp at any size and keeps the text selectable - the right choice for documentation. PNG for somewhere that will not accept an SVG. PDF for printing or attaching to a report: the page is cut to the diagram and drawn as vectors. A diagram with letters outside Western European scripts (Chinese, Arabic, Cyrillic and so on) goes into the PDF as a sharp picture instead, because the PDF's built-in fonts do not have them.
- My diagram will not render. What is wrong?
- The message under the editor names the line and quotes the spot where Mermaid stopped reading; Go to line selects it. Common causes: the first line does not declare the diagram type, an arrow is written wrongly (
-->, not ->, in a flowchart), or a label has brackets or quotes that need wrapping in double quotes. Start from one of the examples and change it a piece at a time. - Can I put a diagram on my website or blog?
- Press Website embed and paste the code into your page's HTML: a Custom HTML block in WordPress, the HTML view in Blogger, or the Embed element of most site builders. The diagram is drawn live in a small frame, in the theme you chose, and stays sharp at any zoom. To change it later, use the edit link under the diagram, then copy a new embed code. The diagram travels in the part of the address after the #, so nothing about it is stored on this site; your visitors' browsers load the frame from johnmcm.com like any embedded video.
- Is my diagram sent anywhere?
- No. Mermaid runs in your browser, so an architecture diagram of an internal system stays internal. A shared link or an embed carries the diagram in the part of the address after the #, which browsers never send to the server.