Mermaid Validator & Diagram Inventory
Validate Mermaid and audit every fenced diagram in your Markdown
Scan a Markdown document for every mermaid, math, or other fenced block — then validate Mermaid syntax with the official parser before you commit. Runs locally using the same Mermaid bundle as our live editor preview.
| Kind | Lang tag | Starts at line | Lines | Preview |
|---|---|---|---|---|
| mermaid | mermaid | L5 | 4 | flowchart LR A[Start] --> B{Done?} B -->|yes| C[Ship] B -->|no| D[Iterate] |
| math | tex | L14 | 1 | E = mc^2… |
| other | graphql | L20 | 1 | type Query { hello: String } |
How to use the diagram tools
Inventory diagrams in a Markdown document
- Paste a Markdown document, or click Open .md to load one from disk.
- The table lists every fenced code block with its kind (mermaid / math / other), language tag, starting line, line count, and a short preview.
- The badge row above shows totals at a glance — useful when auditing a large docs repo before a static-site build.
- Click Send first Mermaid block to validator to forward a diagram into the validator tab.
Validate Mermaid syntax
- Paste Mermaid source, or pull one in from the inventory tab.
- Press Validate syntax. The tool loads the official Mermaid parser and reports either a green confirmation with the diagram type, or a red error with the parser message.
- Fix the issue and validate again — there is no round trip to any server.
Why a separate Mermaid validator?
GitHub and most static-site generators render Mermaid silently — if the syntax is wrong, the block stays as plain text or shows an unhelpful "Unable to render" message. By validating before you commit, you avoid landing broken diagrams in a release. The same applies to a docs CI pipeline: catching parse errors in pre-flight is much faster than discovering them after git push.
The diagram inventory adds a second layer of value: it gives you an instant overview of where diagrams live in a document or repo, which is invaluable when:
- Migrating doc platforms and you need to budget for diagram conversion.
- Theming or rebranding — finding every
flowchartto update colors. - Replacing PNGs with code-first diagrams and tracking progress.
Mermaid diagram types at a glance
| Diagram | Use case | Example fence tag |
|---|---|---|
| Flowchart | Process flows, decision trees | mermaid |
| Sequence | API calls, messaging between actors | mermaid |
| Class | Object-oriented domain models | mermaid |
| State | Finite-state machines | mermaid |
| ER | Database entity relationships | mermaid |
| Gantt | Project timelines | mermaid |
| Pie | Quick percentage breakdowns | mermaid |
| Mindmap | Brainstorms, taxonomies | mermaid |
| Journey | User journey mapping | mermaid |
| Git graph | Branching workflows | mermaid |
All of these are recognized by the validator. If the parser returns a diagram type you don't expect, double-check that the first non-empty line declares the intended diagram (e.g. sequenceDiagram vs. flowchart LR).
Tips for writing Mermaid that just works
- Keep one diagram per fence. Two diagrams in the same
\``mermaid` block won't parse. - Avoid reserved keywords in unquoted labels. Wrap labels containing
end,class, or punctuation in double quotes. - Use simple ASCII first. Smart quotes and en-dashes pasted from Notion or Word cause parse failures. Run new diagrams through this validator before committing.
- Pin Mermaid versions for production docs. Diagram types and node syntax sometimes evolve; pinning prevents a Mermaid upgrade from silently breaking pages.
Companion tools
- Markdown Editor — write and preview Mermaid live with KaTeX, GFM, and slug IDs.
- Markdown Outline Reorder — restructure a doc that contains many diagrams without losing them.
- GFM Compliance Checklist — verify fences declare languages so syntax highlighting works.
Privacy & data
- The Mermaid library, the parser, and the inventory scan all run inside your browser tab.
- Security level is set to
strict— no JavaScript inside diagram labels is ever executed. - We never upload, log, or store diagram source.
Frequently asked questions
- A Mermaid validator parses your diagram source the same way Mermaid itself does and reports whether the syntax is valid. It catches mistakes — wrong arrow direction, missing brackets, unknown diagram type — before you push to a repo where the render will silently fail.
- All diagram types shipped by the official Mermaid bundle: flowchart, sequenceDiagram, classDiagram, stateDiagram, erDiagram, journey, gantt, pie, mindmap, timeline, gitGraph, requirement, quadrantChart, sankey, xychart, block, and more — whatever the version of Mermaid we bundle currently supports.
- It scans your Markdown for every fenced code block and labels each one as Mermaid, math (TeX / Math fences), or Other. You get the language tag, the starting line number, the line count, and a short preview — useful for auditing a docs repo before a static-site build.
- No. We import the official Mermaid library into your browser, configure it with `securityLevel: strict`, and parse locally. Nothing — neither the document, the diagram, nor any metadata — leaves your tab.
- Common causes: a stray colon in a node label, a quoted string containing a reserved keyword, mismatched braces in a sequenceDiagram, or use of a diagram type that landed in Mermaid after the version GitHub renders with. Paste the source into the validator to see the exact parser error.
- Yes. Click Open .mmd / .md on the validator tab and pick the file. It loads locally, runs through the same parser, and shows the result without leaving your browser.