Package Exports
- @mermaid-js/mermaid-cli/index.bundle.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mermaid-js/mermaid-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mermaid-cli
This is a command-line interface (CLI) for mermaid. It takes a mermaid definition file as input and generates an svg/png/pdf file as output.
Example Usage
Locate how to call the mmdc executable for your preferred method i.e. Docker, Yarn, NPM, global install, etc. Try these examples to get started quickly.
Convert Mermaid mmd Diagram File To SVG
mmdc -i input.mmd -o output.svgCreate A PNG With A Dark Theme And Transparent Background
mmdc -i input.mmd -o output.png -t dark -b transparentPiping from stdin
You can easily pipe input from stdin. This example shows how to use a heredoc to send a diagram as stdin to mermaid-cli (mmdc).
cat << EOF | mmdc
graph TD
A[Client] --> B[Load Balancer]
EOFSee All Available Options
mmdc -hUse Docker:
docker pull minlag/mermaid-clior e.g. version 8.8.0
docker pull minlag/mermaid-cli:8.8.0The container looks for input files in /data. So for example, if you have a
diagram defined on your system in /path/to/diagrams/diagram.mmd, you can use
the container to generate an SVG file as follows:
docker run -it -v /path/to/diagrams:/data minlag/mermaid-cli -i /data/diagram.mmdInstall locally
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 -hOr use NPM:
npm install @mermaid-js/mermaid-cli
./node_modules/.bin/mmdc -hInstall globally
❗️ 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
Install with brew
brew install mermaid-cliRun with npx
npx 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
Known issues
For contributors
Contributions are welcome. See the contribution guide.