About

A drawing that agrees to live in a text file

Last updated 24 November 2026

Mermaid is a grammar for pictures. A few lines describe nodes, order and labels, and a renderer turns them into a diagram. This page is a studio built around that exchange, with the source always in front of you.

What happens when you type

The page waits for a pause of about 300 milliseconds, then hands the whole source to the bundled Mermaid engine and asks for an SVG. The SVG is placed in the plate on the right and its own size is measured from the viewBox, so the canvas can fit it and the export can size it without guessing.

Before the parser runs, a small checker reads the source itself. It looks for the things that break most often and can be seen without parsing: a bracket that opens and never closes, an arrow with no target, a sequence message with no colon, an alt block with no end, a gantt line with no date. Those notes appear under the editor with their line numbers. They are not errors until the parser agrees; when it does not, its own message is the one that stops the drawing.

How a broken line is named

Mermaid reports a parse error with a line and a caret. The studio reads that line, clamps it to the source, quotes the line itself, and adds a sentence about what that line is usually missing. The gutter marks the same line, the editor scrolls to it, and the last plate that parsed stays on the canvas behind a dimming layer, so a mistake costs a second rather than the picture you had.

The full parser message is kept under a disclosure. It is written for a person reading the grammar, not for someone who just wants their diagram back, and it is useful exactly when the short sentence is not enough.

The two plates

A diagram has its own colour, separate from the page. Paper is the light plate: warm background, ochre lines, a red accent on one node. Ink is the dark plate: graphite background, sand lines, a lighter red. Auto follows the page theme, and the choice is remembered in this browser.

Every diagram is rendered from scratch when the theme changes, because the colours live inside the SVG rather than in a stylesheet. That is also why an exported PNG carries the plate colour: it is a picture of what you saw, not a transparent layer that disappears on a dark slide.

Zoom, pan and fit

The plate is a canvas with a transform. The wheel zooms around the pointer, a drag moves the diagram, a double click fits it again, and two fingers pinch on a phone. Fit leaves a margin and never blows a small diagram up past 160 percent, so a two node sketch does not become a wall of text.

Four ways out

Where it stops

Who made it

Pikkola Lab builds small tools that keep the work in the browser. This is tool No. 65. Write to hello@pikkola.com with a diagram that will not draw, and say which line the parser stopped on.

Back to the studio