Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
Go to file
fardog 46a7eaea7d Better information around CLI's phantomjs requirement 2014-12-20 17:49:06 -08:00
bin Adds CLI for rendering mermaid files 2014-12-20 17:18:38 -08:00
conf Style in place for edges 2014-11-13 19:51:05 +01:00
dist Work with loop rendering for sequence diagrams 2014-12-20 09:19:56 +01:00
editor initial setup for editor page to generate graph through textarea input 2014-12-01 20:50:58 +01:00
lib Adds CLI for rendering mermaid files 2014-12-20 17:18:38 -08:00
node_modules/jison/node_modules/ebnf-parser Version 0.1.0 2014-11-16 19:00:01 +01:00
scripts Adding missing files 2014-11-13 19:53:31 +01:00
src Sequence diagram loop margins 2014-12-20 18:41:20 +01:00
test Adds CLI tests 2014-12-20 17:40:58 -08:00
.gitignore Merge branch 'pr/2' 2014-12-14 22:30:42 +01:00
.travis.yml Updated readme and changes to the coverage setting on the ci server 2014-11-27 19:34:35 +01:00
CONTRIBUTING.md Update CONTRIBUTING.md 2014-12-03 17:28:21 +01:00
LICENSE Initial commit 2014-11-02 00:52:32 +01:00
README.md Better information around CLI's phantomjs requirement 2014-12-20 17:49:06 -08:00
bower.json Release 0.2.16 2014-12-15 19:35:09 +01:00
gulpfile.js Adds CLI tests 2014-12-20 17:40:58 -08:00
package.json Adds CLI tests 2014-12-20 17:40:58 -08:00

README.md

mermaid Build Status Code Climate

Generation of diagrams and flowcharts from text in a similar manner as markdown.

Ever wanted to simplify documentation and avoid heavy tools like Visio when explaining your code?

This is why mermaid was born, a simple markdown-like script language for generating charts from text via javascript.

The code below would render the following image

graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;

would render this lovely chart:

Example 1

A page with a live example can be seen here. You can also look at mermaid in action using jsbin. If you want a live demo, there is an editor provided in the mermaid project or you can simply look at this great editor

The main documentation is located in the wiki

Another graph example

graph LR;
    A[Hard edge]-->|Link text|B(Round edge);
    B-->C{Decision};
    C-->|One|D[Result one];
    C-->|Two|E[Result two];

Below is the new declaration of the graph which since 0.2.16 also is valid along with the old declaration of the graph as described in the graph example on the home wiki page.

graph LR
    A[Hard edge] -->|Link text| B(Round edge)
    B --> C{Decision}
    C -->|One| D[Result one]
    C -->|Two| E[Result two]

Example 2

mermaid CLI

Installing mermaid globally (npm install -g mermaid) will expose the mermaid command to your environment, allowing you to generate PNGs from any file containing mermaid markup via the command line.

Note: The mermaid command requires PhantomJS (version ^1.9.0) to be installed and available in your $PATH, or you can specify it's location with the -e option. For most environments, npm install -g phantomjs will satisfy this requirement.

Usage

$ mermaid --help

Usage: mermaid [options] <file>...

file    The mermaid description file to be rendered

Options:
  -s --svg          Output SVG instead of PNG (experimental)
  -p --png          If SVG was selected, and you also want PNG, set this flag
  -o --outputDir    Directory to save files, will be created automatically, defaults to `cwd`
  -e --phantomPath  Specify the path to the phantomjs executable
  -h --help         Show this message
  -v --verbose      Show logging
  --version         Print version and quit

Known Issues

  • SVG output currently does some replacement on text, as mermaid's SVG output is only appropriate for browsers. Text color and background color is not yet replicated; please use PNGs for most purposes until this is resolved.
  • SVG output is decidedly non-standard. It works, but may cause issues in some viewers.

Credits

Many thanks to the d3 and dagre-d3 projects for providing the graphical layout and drawing libraries! Thanks also to the js-sequence-diagram project for usage of the grammar for the sequence diagrams.

Mermaid was created by Knut Sveidqvist for easier documentation.