Skip to content

Diagram as Code

Renders Mermaid flowcharts, sequence diagrams and pie charts as you type with its own parser and layout, lists exactly which syntax it supports, and exports SVG or PNG.

Mermaid text on the left, the picture on the right, updating as you type. The parser, the layout and the renderer are this site’s own rather than the Mermaid library, which is why the supported grammar is listed on the page in full — three diagram types, and for each exactly the constructs that are read.

🔒 Runs entirely in your browserdiagrammermaidflowchartdocs

Mermaid code

Preview

WarehouseyesnoOrder receivedIn stock?Take paymentWait for restockShip
Supported grammar (anything else is reported as an error with a line number)

Flowchart — graph / flowchart

  • Directions TD, TB, LR, RL, BT
  • Shapes [ ], ( ), ([ ]), [[ ]], [( )], (( )), > ], { }, {{ }}
  • Lines -->, ---, -.->, -.-, ==>, ===
  • Labels -->|text|, -- text -->, -. text .->, == text ==>
  • A --> B --> C, A & B --> C
  • subgraph name [title] … end (nesting allowed)
  • style, classDef, class, :::className
  • %% comments, ; separators

Not supported: click, linkStyle, direction, the <-->, --o and --x arrows, Markdown strings

Sequence — sequenceDiagram

  • participant A as Name, actor B
  • ->>, -->>, ->, -->, -x, --x, -), --)
  • ->>+B / ->>-B, activate / deactivate
  • Note left of · right of · over A,B
  • loop, alt / else, opt … end
  • autonumber

Not supported: par, critical, break, rect, box, create/destroy, links

Pie — pie

  • pie [showData] [title Something]
  • "name" : value

Class, state, ER, gantt, mindmap and the other diagram types are not drawn yet. There is a separate tool for Gantt charts.

How to use it

  1. Start from an example

    Flowchart, sequence and pie each have a sample that uses most of what the parser understands. Editing one is faster than writing from the syntax list.

  2. Read the error by line number

    Anything outside the supported grammar is refused with the line and what was wrong, rather than leaving a blank canvas for you to bisect.

  3. Export or print

    SVG keeps the text selectable and scales cleanly; PNG at 2× is the safe choice for a slide deck or a chat message.

Common questions

Which diagram types work?

Flowchart (graph / flowchart), sequenceDiagram and pie. Class, state, ER, gantt, gitGraph, mindmap and the rest are named in the error rather than failing vaguely — for a Gantt chart there is a separate tool on this site.

My diagram works on mermaid.live but not here

Likely a construct outside the list on the page — `click`, `linkStyle`, `direction` inside a subgraph, the `<-->`, `--o` and `--x` arrows, YAML front matter, or Markdown strings. The error names which one, and the list is the full contract.

Does Korean text lay out correctly?

Yes. Box widths are measured with CJK characters counted at full width, so a Korean label does not overflow its node the way it does in renderers that assume every character is half-width.

Is my diagram sent anywhere?

No. Parsing and rendering happen in the page, and the draft is kept in this browser. Nothing is uploaded, which matters when the diagram is your internal architecture.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.