Mermaid: Markdown-like text to diagram generation
JavaScript library rendering text-based diagrams as SVG.
Learn more about Mermaid
Mermaid is a JavaScript library that parses markdown-inspired text syntax and renders it as SVG diagrams in the browser. It uses a text-based domain-specific language to define diagram structure, which is then processed by a renderer to produce visual output. The tool supports multiple diagram types including flowcharts, sequence diagrams, class diagrams, state diagrams, and mind maps. It integrates with documentation platforms, GitHub, and can be embedded in web applications or used via a live editor.
Text-Based Diagram Definition
Diagrams are defined using markdown-inspired syntax instead of graphical editors, enabling version control through Git and direct embedding in documentation. Changes are tracked as code diffs, making collaboration and review workflows identical to source code.
Multi-Diagram Single Library
Supports flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, and mind maps without switching tools. Single dependency handles all diagram types with consistent syntax patterns.
Native Platform Integration
Renders directly in GitHub markdown, GitLab, and major documentation platforms without preprocessing. Available via CDN, npm package, or standalone live editor for immediate use in any web environment.
import mermaid from 'mermaid';
mermaid.initialize({ startOnLoad: true });
const diagram = `flowchart TD
A[Start] --> B{Is Valid?}
B -->|Yes| C[Process]
B -->|No| D[Error]`;
await mermaid.render('diagramId', diagram);Fix for downstream import issues by inlining non-layered-tidy-tree-layout dependency.
- –fix: Inline non-layered-tidy-tree-layout to avoid downstream import issues
Critical fix for Gantt diagram crashes caused by invalid dates and tick intervals.
- –fix: validate dates and tick interval to prevent UI freeze/crash in gantt diagramtype
Security backport updating dagre-d3-es dependency and DOMPurify to address CVE vulnerabilities.
- –This release backports the update of the dependency dagre-d3-es to 7.0.13 for CVE-2025-57347 from v11.12.1
- –We've also updated the v10.x branch to support newer versions of DOMPurify, cherry-picked from avoiding CVE-2025-26791
See how people are using Mermaid
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
code-server
Run VS Code on remote servers via browser.
Moq
Mock .NET objects using lambda expressions and LINQ.
ZXing
Multi-format 1D/2D barcode decoder in Java.
Gemini CLI
CLI for Google Gemini AI with text, image, and multimodal interactions from terminal.
QR Scanner
Webcam and image QR detection with native API fallback.