New Bring your own storage. Keep your diagrams in your own private GitHub repository, on Pro and Team.Bring your own storage on GitHub, for Pro and Team. Learn more about bring your own storage

Mermaid scope

Zindex reads three kinds of Mermaid: flowchart (or graph), erDiagram and sequenceDiagram. It converts them with the official Mermaid parser, version 12.1.0, and no model, so the same text always gives the same diagram. Every other Mermaid type is refused. Zindex’s eight diagram families cover more than these three types: write a workflow, UI flow, org chart or network diagram as a scene (Diagram families).

Mermaid works wherever a scene does:

The text can be up to 64 KB. If it holds fenced code blocks tagged mermaid, as a chat answer often does, the first one is the diagram. A title in front matter becomes the diagram’s title, and config: can set its theme. Other front matter is ignored, apart from two sequence diagram settings (Sequence diagrams).

What the conversion draws differently or leaves out comes back in warnings, each with a code and one line saying what happened, and doesn’t stop the save. A response lists at most 10 warnings, and the lines Zindex ignores (below) get none. Validation rules: Mermaid notes lists every code. The converted diagram is then checked like any scene: if it breaks a rule, such as more than 1,000 elements (edges included), nothing is saved and the answer is VALIDATION_FAILED. A flowchart with more than 1,000 edges gets the same answer as soon as the parser reaches the 1,001st, and its error says the scene has more than 1,000 elements without counting them.

Themes

The theme in the text’s config, under config: in front matter or in %%{init}%%, becomes the diagram’s theme. Write names in lowercase, as in the table.

In the configThe diagram’s theme
No themeclean for a new diagram; an edit keeps the diagram’s theme
theme: clean, blueprint or sketch, Zindex’s own namesThat theme
theme: dark, neo-dark, redux-dark or redux-dark-color, or base with themeVariables.darkMode: truedark, or sketch with look: handDrawn
theme: defaultclean
Any other theme, such as neutral or forestclean, with the note THEME_APPROXIMATED

Only sketch draws Mermaid’s look: handDrawn. Beside any theme but sketch or a dark one, or with no theme, the look is left out, with the same note.

Mermaid itself has no clean, blueprint or sketch theme, so other Mermaid tools draw text that names them in their default theme. In text meant for both, write theme: dark, with look: handDrawn for sketch.

---
title: Checkout
config:
  theme: blueprint
---
flowchart LR
  cart --> pay

IDs

A node’s ID is its Mermaid ID. An edge written with an ID, such as a e1@--> b, keeps it; any other edge gets an ID made from its ends, such as a--b. An ID Zindex can’t use as written (anything but letters, digits, ., _, : and -, or longer than 200 characters) becomes a readable slug with a short hash.

In a sequence diagram only participants have Mermaid IDs. Its messages, notes, blocks, boxes, highlights and activations are numbered in order (Sequence diagrams).

Flowcharts

A flowchart becomes a flowchart diagram. It keeps the direction its text gives (TB, TD, BT, LR or RL), and runs top to bottom without one. It’s drawn with the flowchart conventions. To draw a service map as an architecture diagram instead, send an updateScene that sets diagramFamily to architecture after saving.

Entity-relationship diagrams

An erDiagram becomes an entityRelationship diagram, laid out left to right whatever direction the text gives.

Sequence diagrams

A sequenceDiagram becomes a sequence diagram, drawn with the sequence conventions.

IDs. Participants keep their Mermaid IDs, by the rules under IDs, and a %% zindex-id comment maps an alias back to its participant. Mermaid gives the rest no IDs, so Zindex numbers them in row order, skipping IDs a participant holds:

ElementIDs
Messagesm1, m2, and so on
Notesnote1, note2, and so on
Fragments (blocks)by operator: loop1, alt1, opt1, and so on
Activation barsact1, act2, and so on
Participant boxesbox1, box2, and so on, in the order written
Highlights (rect)rect1, rect2, and so on

Participants and rows:

MermaidZindex
participant, labeled by as, @{ "alias" } or <br/>; a participant used without being declaredsequence.lifeline, in the order they first appear
actor, @{ "type": "actor" }sequence.actor
@{ "type": "database" }, and the same for boundary, control, entity, collections and queuesequence.database, sequence.boundary, sequence.control, sequence.entity, sequence.collections and sequence.queue
activate and deactivate, or + and - on a messagesequence.activation, from the message before activate (or the + message) to the message before deactivate (or the - message)
Note over A, Note over A,Bsequence.note over A, or across A to B
Note left of A, Note right of Asequence.note beside A, with extensions.side
loop, opt, break, alt/else, par/and, critical/optiona fragment frame with that operator, its guard as the title ([guard]), and each else, and or option as an operand
box round participants, with or without a color and a titlea frame that lists those participants, with the title and the color as its style.fill: a participant box
rect and a color round rowsa frame that lists those rows, with the color as its style.fill: a highlight band behind them
create participant B before a message to Bthat message as sequence.create, B’s lifeline starting there
destroy B before a message to Bthat message as sequence.destroy, B’s lifeline ending there
title, or title in front matterthe diagram’s title
mirrorActors: false, in front matter or %%{init}%%showLifelineFeet: false: no foot under the lifelines

A box written transparent, or with no color, has no fill. Rendering: Participant boxes and highlight bands says how both are drawn and where they stop: boxes don’t nest or overlap, and a long message label can cross a box’s border.

Write a fragment’s guard on one line: a fragment draws its title and guards on one row.

Messages. The type says what a message means. Where Mermaid draws its line or arrowheads differently from the type, that difference is written too, so the drawing matches Mermaid’s:

MermaidLine and headZindex
->>solid, filled headsequence.message
->solid, no headsequence.message, endArrow: "none"
-)solid, open headsequence.async
-xsolid, crosssequence.message, endArrow: "cross"
<<->>solid, filled heads at both endssequence.message, startArrow: "triangle"
-->>dotted, filled headsequence.reply, endArrow: "triangle"
-->dotted, no headsequence.reply, endArrow: "none"
--)dotted, open headsequence.reply
--xdotted, crosssequence.reply, endArrow: "cross"
<<-->>dotted, filled heads at both endssequence.reply, startArrow: "triangle", endArrow: "triangle"

A create or destroy message keeps the line it is written with, such as style.dash: [] for a solid create.

Numbering. Mermaid counts every message, numbered or not, and Zindex keeps the numbers Mermaid draws:

Layout engine: Numbered messages has how numbers are drawn.

Drawn differently, with a note:

An imported sequence diagram has no canvas size, so its lifelines spread across the default canvas, 800 px wide, as any sequence diagram’s do. A smaller canvas.width, set with updateScene, draws them closer, as far as their headers and messages allow.

Left out, with a warning

The diagram is saved without these, and each comes back in warnings:

MermaidWhat happensCode
A flowchart subgraphLeft out; its nodes are keptSUBGRAPH_DROPPED
An edge to or from a subgraphLeft out; connect it to a node in the subgraph to keep itCONSTRUCT_DROPPED
style, classDef, class and clickLeft out; set styles on the elements insteadSTYLE_DROPPED
A participant’s link, links, properties and detailsLeft outCONSTRUCT_DROPPED
An empty block, box or rect, or an empty else, and or option sectionLeft outCONSTRUCT_DROPPED
An activate with no deactivate, which Mermaid draws no bar forLeft outCONSTRUCT_DROPPED
An activate that no later message arrives atLeft outCONSTRUCT_DROPPED
A message number with a decimalThe message is kept, unnumberedCONSTRUCT_DROPPED
A message number above 99, where the numbering doesn’t become autonumberThe message is kept, unnumberedCONSTRUCT_DROPPED

Zindex doesn’t draw a flowchart’s subgraphs, so a flowchart that relies on them for grouping loses that grouping. To group a flowchart’s nodes, add frames with operations after saving (Operations: createFrame). Accessibility lines (accTitle, accDescr) and comments are ignored, with no note.

Refused

Nothing is saved, and the answer names the problem:

SentAnswer
Any other Mermaid type, such as classDiagram, stateDiagram or gantt422 UNSUPPORTED_DIAGRAM_TYPE; send the diagram as a scene
Text Mermaid can’t read, such as a syntax error422 PARSE_ERROR; error names the place or the mistake. Zindex never repairs the text
Text over 64 KB413 INPUT_TOO_LARGE. Over MCP, the tool’s input schema refuses it first
Text the parser takes more than 15 seconds on, or stops on422 IMPORT_TIMEOUT or IMPORT_FAILED; send shorter text, or a scene
Empty text; both scene and mermaid, or neither; mermaid with ops or restoreRevision400 INVALID_REQUEST

A PARSE_ERROR carries line when Mermaid names one: the line of the text you sent, counted from 1, where the parser stopped. That can be the line before the mistake. column, counted from 0, comes with it when Mermaid names that too; the sentence in error counts it from 1. A mistake Mermaid describes without a place, such as a participant deactivated twice, has neither.

Reading as Mermaid

A read with view=mermaid writes the diagram as Mermaid you can edit and send back, with its title in front matter. Entity-relationship diagrams come back as an erDiagram, sequence diagrams as a sequenceDiagram, and every other family as a flowchart. The read lists what the text leaves out or writes approximately: in notes over REST, on a note: line over MCP (Notes on a Mermaid view). A flowchart or erDiagram doesn’t write an edge’s step and stepText, and a sequenceDiagram doesn’t write stepText (STEPS_NOT_EXPORTED). No Mermaid type writes emphasis (EMPHASIS_NOT_EXPORTED).

The read writes only theme names Mermaid has: theme: dark for dark, and theme: dark with look: handDrawn for sketch. It writes nothing for clean, Mermaid’s default, or for blueprint, which Mermaid lacks (THEME_NOT_EXPORTED).

Flowchart text doesn’t name the family, so a diagram created from it is a flowchart. A read of any family but flowchart, entity-relationship and sequence says so in FAMILY_NOT_EXPORTED; the saved diagram keeps its family.

In a flowchart:

In an erDiagram:

In a sequenceDiagram:

Edits

Send the whole diagram as mermaid with baseRevision, usually text you read with view=mermaid and changed. Zindex compares it with the baseRevision version and applies only the differences, as operations, making the next version:

Sequence diagram edits

Zindex compares the text with the diagram as its read writes it, so text sent back as read returns noop: true, and what the text doesn’t hold stays as it is.