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);mermaid@11.12.2
- –#7200 - fix: validate dates and tick interval to prevent UI freeze/crash in gantt diagramtype
This release backports the update of the dependency dagre-d3-es to 7.0.13 for CVE-2025-57347 from [v11.12.1](https://github.com/mermaid-js/mermaid/rel
- –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
mermaid@11.12.1
- –#7107 - fix: Updated the dependency dagre-d3-es to 7.0.13 to fix GHSA-cc8p-78qf-8p7q
See how people are using mermaid
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
gemini-cli
CLI for Google Gemini AI with text, image, and multimodal interactions from terminal.
gson
Reflection-based Java library for JSON object conversion.
Keiyoushi Extensions
Extension management for the Keiyoushi multi-source content aggregation platform.
doomemacs
Modular framework with lazy loading and vim keybindings.
ts-node
Execute TypeScript directly without precompilation step.