Block diagrams
Blocks joined by links are read as a flowchart is and placed by rule. One whose meaning is in its grid is placed on that grid, each block in the cell its author gave it.
Declared with block-beta. Of 36 features Mermaid documents for a block diagram, 31 drawn as written, 5 drawn less something. See all 36 drawn both ways, or draw one yourself.

What is read
block and block-beta are read into the same boxes and links as a flowchart. But a block diagram is the one kind whose author places the boxes, on a grid. So it is placed in one of two ways. Where it is a flow (every block is joined to another by a link, every block takes one column, and a space is only there to make room for a link), it is placed by rule, as a flowchart is. Where what it says is where each block is, it is placed on the grid its author wrote: every block in its cell, exactly as wide as the columns it spans, with the links drawn at right angles in the gaps between cells. It is never guessed at: a grid of blocks drawn as a row of boxes would say something its author did not.
| Written | Read as |
|---|---|
shop["Web shop"], shop | A block: a box, called by its words, or by its id when it has none. Words go in quotes; <br/> breaks a line |
a("Round"), a(["Stadium"]), a[["Subroutine"]], a[("Database")], a(("Circle")), a>"Flag"], a{"Decision"}, a{{"Prepare"}}, a[/"Input"/], a[\"Output"\], a[/"Manual"\], a[\"Trapezoid"/], a((("Stop"))) | The same shapes as a flowchart's. A block with round corners is a box and a circle is a pill, as they are there; a cylinder is of the kind that holds data |
a --> b, a --- b, a ==> b, a -.-> b, a --o b, a --x b, a <--> b | A link: solid, thick or dotted, ending in an arrow, nothing, a circle or a cross, or with an arrow at both ends |
a -- "words" --> b, a == "words" ==> b, a -. "words" .-> b | A link with words. They go in quotes, written into the link |
a --> z, where z is written nowhere else | The link, and a block z made for it, as Mermaid makes one |
start("Start") --> stop("Stop") | A link, and each block given its shape and its words there |
block:back … end, block … end | A block that holds others: a group. One inside another is a group inside a group |
block:back["Back office"] | The same, called by its words. Mermaid 11 draws no name for it; Merlive draws the one its author wrote |
shop --> back, back --> bank | A link to or from a block that holds others, joined to where the blocks inside it start or end, as a link to a group is |
columns 3, columns auto in a flow | Which way the flow runs: blocks that fit one row run left to right, any others top to bottom |
a space b with a --> b, space:3 between two joined blocks | Room for the link, which is how Mermaid's own guide says to draw one. Read past |
style a fill:#636,stroke-width:4px, classDef late fill:#fde, class a,b late | Kinds and outlines, as in a flowchart. A style is for one block |
%% words on a line of its own, title: in front matter | As in a flowchart |
Placed on its author's grid, when any of these is written:
| Written | What it says, and how it is drawn |
|---|---|
| A block no link joins to another (a grid of blocks, one block on its own, a block inside another that only the outer one is linked for) | Where it is drawn is all that says what it belongs with. Each block is in the cell it was written in, the cells filled row by row |
columns 3, columns auto | How many columns the grid has: every column as wide as every other, every row as tall as its tallest block. auto is one row |
wh["Warehouse"]:3, block:left:2 | A block that spans columns lies under or beside several others: it is as wide as those columns and the gaps between them. One that does not fit what is left of a row starts the next |
space, space:3 | A cell, or several, left empty, so a block comes where its author wanted it. A line may run through it |
block:left … end with columns of its own | A frame over the cells it spans, round a grid of its own, with room for its name only when it has one |
to<["orders"]>(right), and left, up, down, x, y | A block arrow: an arrow drawn as a block, in its cell, pointing the way written. x points both ways across and y both ways up and down |
to<["orders"]>(x, down) | An arrow along two lines at once is drawn along the first (both ways across), and said: Merlive draws an arrow along one line |
to<[" "]>(down) | An arrow with no words is drawn with none |
a --> b on a grid | A link at right angles: straight across a gap where two blocks face each other, else round the blocks between them and never through one. A link with no way round is said, and the diagram is not written until it has one |
Not read, each named in a note, line when met, and the rest of the line still read:
- words not in quotes (
a[Box],a -- words --> b), which Mermaid does not draw either; - words between bars (
a -->|words| b): write them into the link; - a chain (
a --> b --> c): Mermaid draws no link of it; write each link on a line of its own; - a comment after blocks on one line (
a b %% words): Mermaid draws its words as more blocks; a & b,~~~, a style for several blocks at once (style a,b …), and anything else that is not a block, a space, a link or one of the lines above.
Feature by feature
Every feature Mermaid’s own pages set out for a block diagram, 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.
Written from skills/merlive/reference.md in the repository, so the two cannot disagree.