Git Product home page Git Product logo

mermaid-cli's Introduction

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.

Join our Slack! This project is using Percy.io for visual regression testing. Build, test and deploy

Use Docker:

docker pull minlag/mermaid-cli

or e.g. version 8.8.0

docker pull minlag/mermaid-cli:8.8.0

Install 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 -h

Or use NPM:

npm install @mermaid-js/mermaid-cli
./node_modules/.bin/mmdc -h

Install 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.svg
cat << 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!
EOF

Install with brew

brew install mermaid-cli

Run 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

  1. Linux sandbox issue

For contributors

Contributions are welcome. See the contribution guide.

mermaid-cli's People

Contributors

mindaugaslaganeckas avatar tylerlong avatar dependabot[bot] avatar knsv avatar bgschiller avatar agusmba avatar capellini avatar yash-singh1 avatar fregante avatar bastianzim avatar aler9 avatar neilcuzon avatar 0xflotus avatar alexkrolick avatar abitrolly avatar larsw avatar melhindi avatar pshomov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.