Skip to main content

Command line

mermaidx -i INPUT -o OUTPUT [options]

Without -o, the SVG is written to standard output. Use -i - to read the diagram from standard input.

The output format comes from the extension of -o: .svg, .png, .jpg, .jpeg, .bmp, .tga or .pdf.

OptionDescription
-i, --input FILEMermaid source file, or - for standard input
-o, --output FILEOutput file. Omit it to write SVG to standard output
--backend NAMERendering backend, quickjs by default
--list-backendsList the available backends and exit
-w, --width NOutput width in pixels (PNG, and PDF when fitting)
-H, --height NOutput height in pixels
--scale NSize multiplier, used when -w and -H are omitted
-t, --theme NAMEdefault, forest, dark or neutral
-b, --background COLORCSS background color, transparent by default
-c, --config FILEMermaid JSON config (quickjs and v8 only)
--css FILECSS file to inject into the diagram (quickjs and v8 only)
--quality NJPEG quality from 1 to 100, 90 by default
--pdf-format FORMATPaper format such as A4 or Letter; the default fits the diagram
--landscapeLandscape orientation, PDF only
--margin MARGINPDF margin such as 1cm, 0 by default
-q, --quietHide informational messages
--infoPrint the Mermaid library version and exit
--version, -vPrint the mermaidx version and exit

JPEG has no transparency, so the background is white unless you pass -b.

Examples​

mermaidx -i flow.mmd -o flow.png --scale 2 -b white
mermaidx -i flow.mmd -o flow.pdf --pdf-format A4 --margin 1cm
mermaidx -i flow.mmd -o flow.jpg --quality 80
mermaidx -i flow.mmd --backend v8 -o flow.svg