Mermaid Troubleshooting
Unclosed Syntax
Unclosed quotes or brackets can cause parsing errors.
Incorrect:
A["Unclosed label]
Correct:
flowchart LR
A["Closed label"] --> B
Reserved Words
Avoid lowercase end as a node label when it can be interpreted as a control keyword.
Prefer:
flowchart LR
A[Start] --> B[End]
Mermaid Code Fence
Make sure the Markdown fence is labeled mermaid.
Correct:
```mermaid
flowchart LR
A --> B
```
Diagram Not Rendering
Check:
- The code block is labeled
mermaid. - The host platform supports Mermaid.
- Mermaid is loaded when using HTML.
- The diagram syntax is valid.
- The correct Mermaid version is being used for the syntax.
Subgraph Problems
If a subgraph is collapsed or contains complex connections, verify the supported view: collapsed syntax and the relationships crossing the subgraph boundary.
Export Problems
Some environments may not render Mermaid correctly when exporting to PDF.
A practical approach is to pre-render the diagram using Mermaid CLI:
mmdc -i diagram.mmd -o diagram.svg