Mermaid Diagramming
Mermaid is an excellent diagram format for Markdown: use it for diagrams embedded in Markdown documents and quick conceptual flowcharts. Switch to SVG (svg-diagram) only when the deliverable needs pixel-level polish or a layout Mermaid cannot express, and to Excalidraw (excalidraw-diagramming) only when the user wants an editable whiteboard-style diagram.
Authoring rules
- Prefer
flowchart TDorflowchart LRover the legacygraphspelling. - Use short ASCII node IDs such as
A,claim_db, orreview_1. - Every human-readable node label MUST be double-quoted inside its shape delimiters. Never emit
A[Label]orB{Decision}. WriteA["Label"],B{"Decision"}, andC(["Terminal label"]). - Parentheses, colons, percentages, ampersands, slashes, commas, periods, hyphens, and non-ASCII characters belong only inside those quoted labels.
- Keep syntax outside labels ASCII. Unicode is fine inside quoted labels.
- Use one statement per line. Semicolons are unnecessary.
- Prefer several concise nodes over one node containing a paragraph.
Styling Best Practices
- Produce clean, informative Mermaid diagrams with moderate styling that improves readability.
- Use Mermaid-native styling where supported:
classDef,class,style,linkStyle, and clear subgraph/section titles. - Prefer restrained emphasis: highlight only key nodes/steps, not every element.
- Keep high contrast and legible labels; avoid excessive decoration.
- HTML Usage: Use simple HTML tags in labels/text ONLY when safely supported by the chosen diagram type (e.g., most flowcharts).
- For strict-syntax diagram types (such as
gantt,journey,requirementDiagram,timeline, andpie), keep labels plain text and avoid HTML tags entirely. - Never use script/style tags, inline event handlers, iframes, or external resources.
- For strict-syntax diagram types (such as
Specific Diagram Type Rules
- Requirement Diagram (
requirementDiagram): Theverifymethodfield MUST be one of:analysis,demonstration,inspection, ortest. Do NOT use any other value forverifymethod.
Validation and Output
- Be extremely careful with syntax, as broken Mermaid diagrams will fail to render in standard Markdown previewers. Adhere strictly to the double-quoting rule above to avoid the vast majority of parsing errors.
- When embedding in Markdown, wrap the raw source in exactly one ```mermaid code fence.
- For a standalone
.mmdor.mermaidfile, write the raw source without fences.