Reference

Shapes and lines it reads

Every shape and line the reader knows, the Mermaid it writes for each, and how to change a look or a style.

On this page

A shape is only a look. Mermaid gives no shape a meaning, and neither does mermaidify: every shape starts as a plain node, named by its place in the reading. Draw every step as a box if you like, or a diamond for something that is not a question. If your own work gives shapes meanings, the meanings are yours to keep.

What Mermaid writes#

You drawMermaid writes
A boxA["Node 1"]
A box in a boxA[["Node 1"]]
A wide ovalA(["Node 1"])
A circleA(("Node 1"))
A circle in a circleA((("Node 1")))
A diamondA{"Node 1"}
A hexagonA{{"Node 1"}}
A trapezoid, wide at the bottomA[/"Node 1"\]
A trapezoid, wide at the topA[\"Node 1"/]
A parallelogramA[/"Node 1"/]
A parallelogram leaning leftA[\"Node 1"\]
A triangleA@{ shape: tri, label: "Node 1" }
A triangle pointing downA@{ shape: flip-tri, label: "Node 1" }
A small shape filled inA@{ shape: sm-circ, label: "Node 1" }
A small circle around a filled dotA@{ shape: fr-circ, label: "Node 1" }
A shape around other shapessubgraph G1 ["Group 1"]
An arrow, or a line with no headA --> B
Heads at both endsA <--> B
A line drawn as dashesA -.-> B
A line gone over againA ==> B
A line you namedA -->|"yes"| B
Green, blue, red, or amber inkclassDef, style, linkStyle

Mermaid draws a filled dot as a start and a ring around one as a stop, with no name; in a state diagram they are its start and its end, [*]. Triangles, filled dots, and rings around dots are written in Mermaid's newer shape syntax, which Mermaid 11.3 and later read; an older copy of Mermaid elsewhere will not draw them.

The example on the Draw page reads as this code, leaving out its colors:

flowchart TD
  A(["Node 1"])
  B["Node 2"]
  C{"Node 3"}
  D((("Node 4")))
  A --> B
  B --> C
  C --> D
  C --> B

Looks, styles, and names#

To change a shape's look or a line's style after reading it, pick another from its menu under Names: the code and the diagram follow, and the choice stays with that shape or line as you draw more.

Names are written with Mermaid's character codes, so a quote or an angle bracket in a name stays a character and does not break the code: "Ready? #34;yes#34;" shows as Ready? "yes".