UNPKG

2.1 kBMarkdownView Raw
1# mermaid.cli
2
3Command-line interface for [mermaid](https://mermaidjs.github.io/).
4
5This CLI tool takes a mermaid definition file as input and generates svg/png file as output.
6
7
8## Installation
9
10```
11yarn global add mermaid.cli
12```
13
14 Or
15
16```
17npm install -g mermaid.cli
18```
19
20Please install via `npm` instead of `yarn` if you encounter [this issue](https://github.com/yarnpkg/yarn/issues/2224).
21
22
23## Examples
24
25```
26mmdc -i input.mmd -o output.svg
27```
28
29```
30mmdc -i input.mmd -o output.png
31```
32
33```
34mmdc -i input.mmd -o output.pdf
35```
36
37```
38mmdc -i input.mmd -o output.svg -w 1024 -H 768
39```
40
41```
42mmdc -i input.mmd -t forest
43```
44
45```
46mmdc -i input.mmd -o output.png -b '#FFF000'
47```
48
49```
50mmdc -i input.mmd -o output.png -b transparent
51```
52
53
54## Options
55
56Please run the following command to see the latest options:
57
58```
59mmdc -h
60```
61
62The following is for your quick reference (may not be the latest version):
63
64```
65Usage: mmdc [options]
66
67
68 Options:
69
70 -V, --version output the version number
71 -t, --theme [name] Theme of the chart, could be default, forest, dark or neutral. Optional. Default: default
72 -w, --width [width] Width of the page. Optional. Default: 800
73 -H, --height [height] Height of the page. Optional. Default: 600
74 -i, --input <input> Input mermaid file. Required.
75 -o, --output [output] Output file. It should be either svg, png or pdf. Optional. Default: input + ".svg"
76 -b, --backgroundColor [backgroundColor] Background color. Example: transparent, red, '#F0F0F0'. Optional. Default: white
77 -c, --configFile [config] JSON configuration file for mermaid. Optional
78 -C, --cssFile [cssFile] CSS alternate file for mermaid. Optional
79 -h, --help output usage information
80```
81
82
83## For contributors
84
85### Setup
86
87 yarn install
88 cp ./node_modules/mermaid/dist/mermaid.min.js .
89
90
91### Test
92
93Use the fixtures in `test/` to do manual testing after you change something.