Mermaid error
Square brackets inside a label end the node early
Reproduced on Mermaid 11.17.2 · Updated
Square brackets inside a label end the node early in Mermaid. The exact parser message, why it happens, and corrected source that renders.
What Mermaid says
Parse error on line 2:
...owchart TD A[Item [1] ready] --> B[Nex
----------------------^
Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', '-)', 'STADIUMEND', 'SUBROUTINEEND', 'PIPE', 'CYLINDEREND', 'DIAMOND_STOP', 'TAGEND', 'TRAPEND', 'INVTRAPEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got 'SQS'Why it happens
The first closing square bracket ends the node definition, so the characters after it are read as a new statement on the same line.
The source that fails
flowchart TD
A[Item [1] ready] --> B[Next]How to fix it
Quote the label so the inner brackets stay part of the text.
flowchart TD
A["Item [1] ready"] --> B[Next]Next steps
Paste your own version into the Mermaid repair tool, which applies this correction and fourteen others and shows every change. The related page covers the surrounding syntax, and the error dictionary lists every message.