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.
Use Docker:
docker pull minlag/mermaid-clior e.g. version 8.8.0
docker pull minlag/mermaid-cli:8.8.0Install 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
Examples
To see the latest options, please run the following command: mmdc -h
To convert Mermaid mmd diagram to an svg file, run this command: mmdc -i input.mmd -o output.svg
Piping from stdin
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!
EOFRun 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.