gitbook_multilanguage_template
  • README
  • LANGS
  • README
    • gitbook_markdown
    • GitBook 多语言模板
    • 目录
    • GitBook && GitHub
  • node_modules
    • Mermaid plugin for GitBook
      • node_modules
        • README
          • node_modules
            • README
              • Changelog
            • mkdirp
              • readme
              • node_modules
                • minimist
                  • readme
            • chalk
              • node_modules
                • has-ansi
                  • node_modules
                    • ansi-regex
                      • ansi-regex
                  • has-ansi
                • ansi-styles
                  • ansi-styles
                • strip-ansi
                  • node_modules
                    • ansi-regex
                      • ansi-regex
                  • strip-ansi
                • escape-string-regexp
                  • escape-string-regexp
                • supports-color
                  • supports-color
              • readme
            • he
            • which
              • node_modules
                • is-absolute
                  • node_modules
                    • is-relative
                • isexe
            • dagre - Graph layout for JavaScript
              • node_modules
                • lodash v3.10.1
                • README
            • dagre-d3 - A D3-based renderer for dagre
              • node_modules
                • lodash v3.10.1
                • README
            • semver(1) -- The semantic versioner for npm
            • minimist
              • readme
            • Data-Driven Documents
              • Contributing
          • build
            • content
              • usage
              • Development
              • Upgrading to from version -0.4.0
              • Gant diagrams
              • Sequence diagrams
              • index
              • Flowcharts - Basic Syntax
              • Demos
              • mermaid CLI
              • mermaidAPI
          • docs
            • content
              • mermaid CLI
              • usage
              • Development
              • Upgrading to from version -0.4.0
              • Gant diagrams
              • index
              • Sequence diagrams
              • Flowcharts - Basic Syntax
              • Demos
          • Change Log
          • CONTRIBUTING
          • src
            • diagrams
              • gantt
                • exGantt
    • gitbook-plugin-todo
      • node_modules
        • cheerio
          • CONTRIBUTING
          • node_modules
            • htmlparser2
              • node_modules
                • domhandler
                  • DOMHandler
                • domutils
                  • readme
                • readable-stream
                  • node_modules
                    • core-util-is
                    • isarray
                    • README
                    • README
                • domelementtype
                  • readme
                • entities
                  • entities
            • lodash v3.10.1
            • css-select
              • node_modules
                • domutils
                  • node_modules
                    • domelementtype
                      • readme
                  • readme
                • boolbase
                • css-what
                  • css-what
                • nth-check
            • entities
              • entities
            • dom-serializer
              • node_modules
                • domelementtype
                  • readme
          • History
          • cheerio
        • README
    • gitbook-plugin-toc
      • node_modules
        • marked-toc
          • node_modules
            • Uslug.js
              • node_modules
                • README
                  • LICENSE
            • template
              • node_modules
                • fs-utils
                  • node_modules
                    • JS-YAML - YAML 1.2 parser and serializer for JavaScript
                      • node_modules
                        • README
                          • node_modules
                            • underscore.string
                              • Underscore.string #
                            • README
                          • HISTORY
                        • README
                      • HISTORY
                    • globule
                      • node_modules
                        • minimatch
                          • node_modules
                            • lru cache
                            • sigmund
                        • Glob
                          • node_modules
                            • minimatch
                              • node_modules
                                • lru cache
                                • sigmund
                            • README
                      • test
                        • fixtures
                          • README
                    • graceful-fs
                    • mkdirp
                      • readme
                    • Async.js
                    • README
                  • test
                    • fixtures
                      • foo
                • delims
                • underscore.string
                  • Underscore.string #
            • fs-utils
              • node_modules
                • JS-YAML - YAML 1.2 parser / writer for JavaScript
                  • node_modules
                    • README
                      • CHANGELOG
                      • node_modules
                        • README
                    • README
                  • CHANGELOG
                • delete
                  • node_modules
                    • README
                      • node_modules
                        • Glob
                          • node_modules
                            • inflight
                              • node_modules
                                • wrappy
                            • minimatch
                              • node_modules
                                • brace-expansion
                                  • node_modules
                                    • balanced-match
                                      • LICENSE
                                    • concat-map
                                      • README
                            • README
                            • once
                              • node_modules
                                • wrappy
                            • path-is-absolute
                              • path-is-absolute
                          • changelog
                    • is-path-in-cwd
                      • node_modules
                        • is-path-inside
                          • is-path-inside
                          • node_modules
                            • Is This Path Inside This Other Path?
                      • is-path-in-cwd
                    • is-path-cwd
                      • is-path-cwd
                  • {%= name %} {%= badge("fury") %}
                • is-absolute
                  • node_modules
                    • is-relative
                • globby
                  • node_modules
                    • README
                      • node_modules
                        • once
                          • node_modules
                            • wrappy
                        • minimatch
                          • node_modules
                            • brace-expansion
                              • node_modules
                                • balanced-match
                                  • LICENSE
                                • concat-map
                                  • README
                        • inflight
                          • node_modules
                            • wrappy
                        • README
                    • array-union
                      • node_modules
                        • array-uniq
                          • array-uniq
                      • array-union
                    • array-differ
                      • array-differ
                  • globby
                • Async.js
                • kind-of
                  • {%= name %} {%= badge("fury") %}
                • extend-shallow
                  • node_modules
                    • array-slice
                  • {%= name %} {%= badge("fury") %}
                • relative
                  • {%= name %} {%= badge("fury") %}
                  • node_modules
                    • normalize-path
                      • {%= name %} {%= badge("fury") %}
                • graceful-fs
              • test
                • fixtures
                  • foo
              • {%= name %} {%= badge("fury") %}
            • gray-matter
              • test
                • fixtures
                  • autodetect-javascript
                  • autodetect-no-lang
                  • This page has JSON front matter!
                  • autodetect-coffee
                  • This page has YAML front matter!
                  • autodetect-json
                  • autodetect-yaml
                  • has-matter
                  • to-json
                  • delims-custom
                  • lang-toml
                  • to-yaml
                  • autodetect-coffee-fn
                  • This file doesn't have matter!
                  • autodetect-toml
                  • autodetect-cson-fn
                  • delims-semi-colons
                  • lang-coffee-fn
                  • lang-javascript-fn
                  • complex
                  • lang-cson-fn
                  • This page has cson front matter!
                  • empty
                  • delims-and-lang
                  • This page has coffee front matter!
                  • autodetect-cson
              • {%= name %} {%= badge("fury") %}
              • node_modules
                • README
                  • node_modules
                    • arrayify-compact
                      • node_modules
                        • Array Flatten
                      • {%= name %} {%= badge("fury") %}
                    • object-pick
                • mixin-deep
                  • node_modules
                    • is-plain-object
                      • {%= name %} {%= badge("fury") %}
                    • for-own
                      • node_modules
                        • for-in
                  • {%= name %} {%= badge("fury") %}
                • verbalize
                  • node_modules
                    • chalk
                      • readme
                      • node_modules
                        • ansi-styles
                          • ansi-styles
                        • strip-ansi
                          • strip-ansi
                        • has-color
                          • has-color
                  • docs
                    • install
                    • {%= name %} {%= badge('fury') %}
                • JS-YAML - YAML 1.2 parser / writer for JavaScript
                  • node_modules
                    • README
                      • CHANGELOG
                      • node_modules
                        • README
                    • README
                  • CHANGELOG
                • TOML Parser for Node.js
                  • CHANGELOG
                • README
                  • How to contribute to CoffeeScript
              • docs
                • examples
                • why
                • options
            • marked
            • Lo-Dash v2.4.2
          • test
            • actual
              • Test
              • Handlebars-Helper
              • Related-Grunt-Tasks
              • Repos-List
              • Examples
              • Readme-Repos-List
              • toc
              • Foo
              • Readme3
              • Readme2
              • Readme-Repos
              • Readme1
              • Related-Repos
              • Badge-Mixins
              • Test
            • fixtures
              • repos-list
              • handlebars-helper
              • examples
              • related-grunt-tasks
              • grunt-readme
              • Contains toc stop comment
              • grunt-readme
              • Badges
              • Examples
              • marked-toc
              • Documentation
              • Test
              • grunt-readme
              • grunt-readme
              • Contains extra comment
              • related-repos
              • grunt-readme
    • GitBook Plugin: Advanced Emoji
      • node_modules
        • emojify.js
          • LICENSE
          • LICENSE-IMAGES
          • Contributing
      • assets
        • LICENSE-IMAGES
        • LICENSE
      • Howto Publish to npmjs.org
    • gitbook-plugin-chart
      • node_modules
        • JS-YAML - YAML 1.2 parser / writer for JavaScript
          • node_modules
            • README
            • README
              • CHANGELOG
              • node_modules
                • README
          • CHANGELOG
    • gitbook-plugin-search-pro
      • node_modules
        • README
          • node_modules
            • nan
              • doc
                • Scopes
                • Strings & Bytes
                • Maybe Types
                • New
                • Object Wrappers
                • V8 internals
                • Persistent references
                • Asynchronous work helpers
                • Converters
                • Buffers
                • JavaScript-accessible methods
                • Script
                • Errors
                • Nan::Callback
                • Miscellaneous V8 Helpers
                • Miscellaneous Node Helpers
              • The MIT License (MIT)
              • README
              • NAN ChangeLog
          • README_EN
          • NodeJieba ChangeLog
        • lodash v3.10.1
    • Math typesetting using KaTex
      • node_modules
        • README
          • node_modules
            • match-at
          • README
    • Emphasize texts in GitBook
    • Disqus integration for GitBook
  • README
    • GitBook 多言語対応テンプレート
    • GitBook && GitHub
    • カタログ
    • gitbook_markdown
  • README
    • GitBook && GitHub
    • Table of content
    • gitbook_markdown
    • GitBook Multilanguage Template
Powered by GitBook
On this page
  • Usage
  • Sequence diagram configuration
  • CLI Known Issues

Was this helpful?

  1. node_modules
  2. Mermaid plugin for GitBook
  3. node_modules
  4. README
  5. docs
  6. content

mermaid CLI

PreviouscontentNextusage

Last updated 5 years ago

Was this helpful?

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 (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
  -c --sequenceConfig  Specify the path to the file with the configuration to be applied in the sequence diagram
  -h --help            Show this message
  -v --verbose         Show logging
  -w --width           width of the generated png (number)
  --version            Print version and quit
mermaid testGraph.mmd
mermaid testGraph.mmd -w 980

Sequence diagram configuration

The --sequenceConfig option allows overriding the sequence diagram configuration. It could be useful to increase the width between actors, the notes width or the margin to fit some large texts that are not well rendered with the default configuration, for example.

The content of the file must be a JSON like this:

{
    "diagramMarginX": 100,
    "diagramMarginY": 10,
    "actorMargin": 150,
    "width": 150,
    "height": 65,
    "boxMargin": 10,
    "boxTextMargin": 5,
    "noteMargin": 10,
    "messageMargin": 35
}

These properties will override the default values and if a property is not set in this object, it will left it empty and could raise an error. The current properties (measured in px) are:

  • diagramMarginX: Size of the empty space to add at the left-right of the diagram.

  • diagramMarginY: Size of the empty space to add at the top-bottom of the diagram.

  • actorMargin: Horizontal space between each participant. The arrows between them would have this size too.

  • width: Width of the participant box.

  • height: Height of the participant box.

  • boxMargin: Blank area around loop boxes.

  • boxTextMargin: Blank area between the text and the border in a loop box.

  • noteMargin: Size of the empty space around a note.

  • messageMargin: Space between messages

CLI 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.

PhantomJS