About
A drawing that agrees to live in a text file
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
- SVG. The drawn SVG with a background rectangle and its own size, which is what a slide deck or a print layout wants.
- PNG. The same SVG turned into an image inside the tab and painted at 2 or 3 times its size on a canvas. Nothing is uploaded to rasterise it.
- Markdown. The source in a fenced block, ready for a README or a document.
- A link. The source compressed with the browser's own deflate and written after the hash. The server sees a path and nothing else, and the link keeps working as long as the page does.
Where it stops
- The engine is Mermaid 11.17.2, bundled at
/vendor/mermaid.min.jsunder the MIT licence. Anything that engine cannot draw, this page cannot draw either. - It is not a drawing tool. There is no dragging a node to a new place; the position comes from the grammar, and that is the point.
- It does not call a rendering service. A very large diagram is drawn by the same browser tab, so a machine with little memory will feel it.
- It does not read a
.mmdfolder from your disk. Paste or type the source, then share it as a link.
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.