Flowcharts
Boxes and links, placed by the eight placement rules: the main path in one straight line, every box one size, lines that turn at right angles and go round boxes.
Declared with flowchart TD. Of 70 features Mermaid documents for a flowchart, 49 drawn as written, 20 drawn less something, 1 partly read. See all 70 drawn both ways, or draw one yourself.

What is read
| Written | Read as |
|---|---|
flowchart TD, graph TD, TB | Top to bottom |
flowchart LR | Left to right |
BT, RL | Bottom to top and right to left: the same flow, begun at the far end, with every arrow pointing the way it was written. A right-to-left flow too wide for a screen is turned top to bottom, as a left-to-right one is |
A[Text], A(Text) | A box |
A([Text]), A((Text)) | A start or end (a pill) |
A{Text} | A rhombus, as wide and as tall as the boxes round it |
A{{Text}}, A[(Text)], A[[Text]], A(((Text))), A>Text] | A hexagon, a cylinder (a store of data, of the data kind), a subroutine, a double circle, a flag: each drawn as itself, in the footprint every box shares |
A[/Text/], A[\Text\], A[/Text\], A[\Text/] | The two that lean and the two trapezoids, drawn as themselves |
A["Text with (brackets)"] | A quoted label |
A["one line<br/>and another"] | A label in the author's own lines, up to four |
A["`**Bold** and *italic*`"] | A Markdown string: its words, its own line breaks, and what it makes bold or italic. On a link's words the stars come off and the words are plain |
#quot;, #9829; | An entity code becomes its character |
fa:fa-truck Shipped | An icon is drawn beside its words. The drawing is Merlive's own (seventy-two of them, found by any name Font Awesome has used): nothing is fetched. One Merlive has no drawing for, or a brand's mark, is left out and named in a note, line |
A@{ shape: diam, label: "In stock?" } | A box written the newer way, on one line or several. Its label is kept. Every shape in the rows above is drawn as itself, by any of Mermaid's names for it; a shape Merlive has no drawing for is a box |
A@{ shape: doc }, docs, notch-rect, lin-rect, st-rect, div-rect, win-pane, sl-rect, delay, tri, flip-tri, fork, join | Each drawn as itself, by any of Mermaid's names for it: a document with a waved foot, a stack of documents, a card with its corner cut, a box with a rule down its side, a stack of boxes, a box with a rule across its top, a window pane, a box whose top slopes, a delay with a round end, a triangle, one turned over, and a fork or a join as a bar across the flow. Mermaid's drawings (a cloud, a bolt, a person, braces) are boxes |
A@{ icon: "fa:user", label: "Buyer" } | A box with its label, and Merlive's own drawing of the icon beside it |
A@{ img: "…", label: "…" } | A box with its label. The image is left out: a page of Merlive fetches nothing |
A@{ row: 1, column: 2 }, g@{ view: collapsed } | Read past: placement is Merlive's, and a group is drawn open |
--- … --- at the top | Front matter: its title is the picture's name, drawn above a still picture and as the heading of a page; Mermaid's own settings are read past |
accTitle: …, accDescr: … | What the picture is called and what it shows, kept for readers who cannot see it |
A --> B, A --- B | A link, with or without an arrowhead |
A -.-> B, A ==> B | A dotted link, a thick link |
A --o B, A --x B, A <--> B, A o--o B, A x--x B | A circle, a cross or an arrowhead at either end, drawn as written |
A ~~~ B | An invisible link: its boxes are read, and no link is made. Where boxes go is Merlive's |
A -->|Yes| B, A -- Yes --> B, A -- "two<br/>lines" --> B | A link with words |
A -. maybe .-> B, A == must ==> B, A ---> B | Words in a dotted or thick link; an arrow drawn longer |
subgraph id["Title"] … end, g1 --> g2 | A group, drawn as a frame with its title; a link between groups joins the end of one to the start of the next. A group inside a group has a frame of its own inside the outer one |
A --> B --> C | A chain |
A --> A, A -->|again| A | A link from a box to itself: a small loop beside it. It is not one of the loops %% step: … | loop 1 counts |
A & B --> C & D | Every box before the link, linked to every box after it |
A e1@--> B, e1@{ animate: true } | A link with an id is a link; what Mermaid sets on it (animation, a step, a curve) is read past |
class A,B rework, A:::rework | The kind of a box: its colour comes from the design's kinds. Its name may have a hyphen (read-only) |
classDef red stroke:#c62828 | The class's colour is read for what it means: a kind the design has no colour for takes the design's own nearest colour (this red becomes risk) |
style B stroke:#c00,stroke-width:3px,stroke-dasharray: 5 5 | What the author's own style means is kept: a broken outline, a heavy one, and a colour, named for its hue (red) and drawn in the design's own nearest colour. The fill is the design's |
linkStyle 0 stroke:#c00,stroke-width:4px | The same for a link, by the number Mermaid gives it: heavy, broken, and in the design's nearest colour |
classDef default …, linkStyle default … | Read past: a look for every box or every link is the design's |
click | Read past |
direction LR inside a group | A group whose boxes run across the flow: its boxes in one row, in the order they are linked, the main path through where the flow comes into it; RL and BT the other way. Only for boxes linked one after another in a line: with a branch inside, the group runs as the flow does, and a note, line says so |
Where the Mermaid is kept decides how it is found: fenced mermaid blocks in Markdown (.md, .mdx); the whole of a .mmd file; and, in any other file (an .astro page, a script), a string between backticks that starts as a flowchart does. A string put together with ${…} when the page runs cannot be read.
What is and is not drawn, feature by feature.
Feature by feature
Every feature Mermaid’s own pages set out for a flowchart, each with a sample of it in the corpus. A sample is drawn when every box, link and word it has is read and every rule passes. Drawn, less something is the same with one thing known to be missing, named beside it.
| Feature | Result | What is missing |
|---|---|---|
| A flowchart, declared with "flowchart" | Drawn | |
| A flowchart, declared with "graph" | Drawn | |
| Direction TB: top to bottom | Drawn | |
| Direction TD: top down | Drawn | |
| Direction LR: left to right | Drawn | |
| Direction BT: bottom to top | Drawn | |
| Direction RL: right to left | Drawn | |
| A title and settings in front matter | Drawn, less something | Mermaid's own settings are read past: the look is the design's |
| Settings in an init directive | Drawn, less something | Mermaid's own settings are read past: the look is the design's |
| Comments on lines of their own | Drawn | |
| A title and a description for readers who cannot see it | Drawn | |
| A description written over several lines | Drawn | |
| Statements ended with semicolons, and no spaces | Drawn | |
| Boxes named by their id alone | Drawn | |
| A box with words | Drawn | |
| Words in other alphabets | Drawn | |
| Brackets and signs inside quotes | Drawn | |
| Characters written as entity codes | Drawn | |
| A line break in a label | Drawn | |
| Markdown strings: bold, italic and a real line break | Drawn | |
| A Font Awesome icon in a label | Drawn, less something | The icons are Merlive's own drawings of a truck and a tick, not Font Awesome's |
| Shape: Round edges | Drawn, less something | Its corners are the design's, the same as every box |
| Shape: Stadium | Drawn | |
| Shape: Subroutine | Drawn | |
| Shape: Cylinder, a database | Drawn | |
| Shape: Circle | Drawn, less something | Drawn as a pill: a circle the height of a box would hold three letters |
| Shape: Asymmetric, a flag | Drawn | |
| Shape: Rhombus, a decision | Drawn | |
| Shape: Hexagon | Drawn | |
| Shape: Parallelogram | Drawn | |
| Shape: Parallelogram, leaning back | Drawn | |
| Shape: Trapezoid | Drawn | |
| Shape: Trapezoid, upside down | Drawn | |
| Shape: Double circle | Drawn | |
| Shapes written as @{ shape: … }, with a label | Partly read | its shapes are read as box, diamond, cylinder, document, pill |
| Every one of the 53 newer shapes | Drawn, less something | Those Merlive has a drawing for are drawn as themselves; the rest are boxes |
| A box that is an icon | Drawn, less something | The icon is Merlive's own drawing of a user, beside the label and not above it |
| A box that is an image | Drawn, less something | The image is left out (a page of Merlive fetches nothing); its label is kept |
| Boxes given a row and a column | Drawn, less something | The rows and columns are read past: placement is Merlive's |
| A link with an arrowhead | Drawn | |
| A link with no arrowhead | Drawn | |
| Words on a link, between bars | Drawn | |
| Words on a link, written into it | Drawn | |
| A dotted link, with and without words | Drawn | |
| A thick link, with and without words | Drawn | |
| An invisible link, used to nudge placement | Drawn, less something | Its boxes are read and the link is left out: it is only there to nudge Mermaid's placement, and placement is Merlive's |
| Links chained in one line | Drawn | |
| One line linking to several boxes with & | Drawn | |
| Several boxes to several boxes with & | Drawn | |
| A link ending in a circle or a cross | Drawn | |
| Arrows at both ends | Drawn | |
| Links drawn longer, to push a box further on | Drawn, less something | The extra length is read past: placement is Merlive's |
| A link from a box to itself | Drawn | |
| A link given an id | Drawn | |
| A link set to animate | Drawn, less something | Mermaid's animation is read past: movement is the design's, and starts when a reader asks |
| Links played one step after another | Drawn, less something | The step numbers are read past; a walkthrough is written with "%% step" |
| A link given a curve of its own | Drawn, less something | The curve is read past: lines turn at right angles by rule |
| A group named by its title | Drawn | |
| A group with an id and a title | Drawn | |
| Links to a group and between groups | Drawn | |
| A group with a direction of its own | Drawn | |
| A group inside a group | Drawn | |
| A group shown collapsed | Drawn, less something | Drawn open: a picture cannot be opened and closed |
| A box styled on its own | Drawn, less something | Its outline is broken, heavy and red as written, in the design's own red; its fill is the design's |
| Links styled by their number | Drawn, less something | The link is heavy and red as written, in the design's own red; a default for every link is read past |
| A class made and given to boxes | Drawn | |
| A class given with ::: | Drawn | |
| A default class for every box | Drawn, less something | The default class is read past: the look is the design's |
| A box that calls a function when clicked | Drawn, less something | The click is left out: a page of Merlive runs no code of yours |
| A box that opens a link when clicked | Drawn, less something | The link is left out |
Written from skills/merlive/reference.md in the repository, so the two cannot disagree.