UNPKG

2.68 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/pdf file as output.
6
7
8## Install locally
9
10Some people are [having issue](https://github.com/mermaidjs/mermaid.cli/issues/15) installing this tool globally. Installing it locally is an alternative solution:
11
12```
13yarn add mermaid.cli
14./node_modules/.bin/mmdc -h
15```
16
17Or use NPM:
18
19```
20npm install mermaid.cli
21./node_modules/.bin/mmdc -h
22```
23
24
25## Install globally
26
27❗️ We do **NOT** recommend installing it globally because both YARN and NPM could fail to install a command line tool globally properly due to weird permission issues.
28
29```
30yarn global add mermaid.cli
31```
32
33 Or
34
35```
36npm install -g mermaid.cli
37```
38
39
40## Examples
41
42```
43mmdc -i input.mmd -o output.svg
44```
45
46```
47mmdc -i input.mmd -o output.png
48```
49
50```
51mmdc -i input.mmd -o output.pdf
52```
53
54```
55mmdc -i input.mmd -o output.svg -w 1024 -H 768
56```
57
58```
59mmdc -i input.mmd -t forest
60```
61
62```
63mmdc -i input.mmd -o output.png -b '#FFF000'
64```
65
66```
67mmdc -i input.mmd -o output.png -b transparent
68```
69
70
71## Options
72
73Please run the following command to see the latest options:
74
75```
76mmdc -h
77```
78
79The following is for your quick reference (may not be the latest version):
80
81```
82Usage: mmdc [options]
83
84
85 Options:
86
87 -V, --version output the version number
88 -t, --theme [theme] Theme of the chart, could be default, forest, dark or neutral. Optional. Default: default (default: default)
89 -w, --width [width] Width of the page. Optional. Default: 800 (default: 800)
90 -H, --height [height] Height of the page. Optional. Default: 600 (default: 600)
91 -i, --input <input> Input mermaid file. Required.
92 -o, --output [output] Output file. It should be either svg, png or pdf. Optional. Default: input + ".svg"
93 -b, --backgroundColor [backgroundColor] Background color. Example: transparent, red, '#F0F0F0'. Optional. Default: white
94 -c, --configFile [configFile] JSON configuration file for mermaid. Optional
95 -C, --cssFile [cssFile] CSS file for the page. Optional
96 -p --puppeteerConfigFile [puppeteerConfigFile] JSON configuration file for puppeteer. Optional
97 -h, --help output usage information
98```
99
100
101## For contributors
102
103### Setup
104
105 yarn install
106 cp ./node_modules/mermaid/dist/mermaid.min.js .
107
108
109### Test
110
111Use the fixtures in `test/` to do manual testing after you change something.