LinuxCommandLibrary

mermaid

TLDR

Generate diagram from file

$ mmdc -i [input.mmd] -o [output.png]
copy
Output as SVG
$ mmdc -i [input.mmd] -o [output.svg]
copy
Output as PDF
$ mmdc -i [input.mmd] -o [output.pdf]
copy
Use specific theme
$ mmdc -i [input.mmd] -o [output.png] -t [dark]
copy
Set background color
$ mmdc -i [input.mmd] -o [output.png] -b [white]
copy
Read from stdin
$ echo "graph LR; A-->B" | mmdc -o [diagram.png]
copy

SYNOPSIS

mmdc [options]

DESCRIPTION

mmdc (Mermaid CLI) renders Mermaid diagrams from text definitions to images. Mermaid is a diagramming language for flowcharts, sequence diagrams, class diagrams, and more.
The tool enables automated diagram generation in documentation pipelines and scripts.

PARAMETERS

-i file

Input mermaid file.
-o file
Output file.
-t theme
Theme (default, forest, dark, neutral).
-b color
Background color.
-c file
Config JSON file.
-w width
Width in pixels.
-H height
Height in pixels.
-p file
Puppeteer config file.
-s scale
Scale factor.

DIAGRAM TYPES

graph/flowchart: Flow diagrams
sequenceDiagram: Sequence diagrams
classDiagram: Class diagrams
stateDiagram: State machines
gantt: Gantt charts
pie: Pie charts

CAVEATS

Requires Puppeteer/Chromium. Complex diagrams may need tuning. PDF quality varies. Large diagrams can be slow.

HISTORY

Mermaid was created by Knut Sveidqvist around 2014 to provide a simple text-based diagramming language. The CLI tool enables command-line rendering, complementing web-based rendering in browsers and documentation tools.

SEE ALSO

graphviz(1), plantuml(1), ditaa(1), drawio(1)

Copied to clipboard