This is a command-line interface (CLI) for mermaid. It takes a mermaid definition file as input and generates svg/png/pdf file as output.
docker pull minlag/mermaid-cli or e.g. version 8.8.0 docker pull minlag/mermaid-cli:8.8.0
Some people are having issue installing this tool globally. Installing it locally is an alternative solution:
yarn add @mermaid-js/mermaid-cli
./node_modules/.bin/mmdc -h
Or use NPM:
npm install @mermaid-js/mermaid-cli
./node_modules/.bin/mmdc -h
❗️ 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.
yarn global add @mermaid-js/mermaid-cli or npm install -g @mermaid-js/mermaid-cli
Please run the following command to see the latest options: mmdc -h
Run this command to convert Mermaid mmd diagram to an svg file:
mmdc -i input.mmd -o output.svg
You can also pipe input from stdin
# create_mermaid_output is an executable that sends mermaid output to stdout
create_mermaid_output | mmdc -o output.svgcat << EOF | mmdc
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
EOFnpx is installed by default with NPM. It downloads and runs commands at the same time.
To use Mermaid CLI with npx, you need to use the -p flag because the package name is different than the command it installs (mmdc).
npx -p @mermaid-js/mermaid-cli mmdc -h
Contributions are welome. See the contribution guide.