@mermaid-js/mermaid-cli 9.2.2 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -23
- package/dist/index.html +802 -507
- package/package.json +5 -5
- package/src/index.js +53 -36
- /package/dist/assets/{fa-brands-400.ce2af7e2.svg → fa-brands-400-ce2af7e2.svg} +0 -0
- /package/dist/assets/{fa-regular-400.e519b693.svg → fa-regular-400-e519b693.svg} +0 -0
- /package/dist/assets/{fa-solid-900.3e918c25.svg → fa-solid-900-3e918c25.svg} +0 -0
package/README.md
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
# mermaid-cli
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@mermaid-js/mermaid-cli)
|
|
4
|
+
[](https://www.npmjs.com/package/@mermaid-js/mermaid-cli)
|
|
5
|
+
[](https://hub.docker.com/r/minlag/mermaid-cli)
|
|
6
|
+
[](https://github.com/mermaid-js/mermaid-cli/actions/workflows/compile-mermaid.yml)
|
|
7
|
+
[](https://percy.io/Mermaid/mermaid-cli)
|
|
8
|
+
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
|
9
|
+
|
|
3
10
|
This is a command-line interface (CLI) for [mermaid](https://mermaid-js.github.io/). It takes a mermaid definition file as input and generates an svg/png/pdf file as output.
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
## Installation
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
```sh
|
|
15
|
+
npm install -g @mermaid-js/mermaid-cli
|
|
16
|
+
```
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
Yarn, NPM, global install, etc. Try these examples to get started quickly.
|
|
18
|
+
## Usage
|
|
11
19
|
|
|
12
|
-
|
|
20
|
+
Convert Mermaid mmd Diagram File To SVG
|
|
13
21
|
|
|
14
22
|
```sh
|
|
15
23
|
mmdc -i input.mmd -o output.svg
|
|
16
24
|
```
|
|
17
25
|
|
|
26
|
+
> **Note**
|
|
27
|
+
>
|
|
28
|
+
> See [Alternative installations](#alternative-installations) if you don't want to install the package globally.
|
|
29
|
+
>
|
|
30
|
+
> Locate how to call the mmdc executable for your preferred method
|
|
31
|
+
> i.e. Docker, Yarn, NPM, local install, etc.
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
18
35
|
### Create A PNG With A Dark Theme And Transparent Background
|
|
19
36
|
|
|
20
37
|
```sh
|
|
@@ -92,7 +109,7 @@ You can easily pipe input from stdin. This example shows how to use a heredoc to
|
|
|
92
109
|
send a diagram as stdin to mermaid-cli (mmdc).
|
|
93
110
|
|
|
94
111
|
```sh
|
|
95
|
-
cat << EOF | mmdc
|
|
112
|
+
cat << EOF | mmdc --input -
|
|
96
113
|
graph TD
|
|
97
114
|
A[Client] --> B[Load Balancer]
|
|
98
115
|
EOF
|
|
@@ -104,6 +121,8 @@ EOF
|
|
|
104
121
|
mmdc -h
|
|
105
122
|
```
|
|
106
123
|
|
|
124
|
+
# Alternative installations
|
|
125
|
+
|
|
107
126
|
## Use Docker:
|
|
108
127
|
|
|
109
128
|
```sh
|
|
@@ -112,7 +131,7 @@ docker pull minlag/mermaid-cli
|
|
|
112
131
|
|
|
113
132
|
or pull from Github Container Registry
|
|
114
133
|
|
|
115
|
-
```sh
|
|
134
|
+
```sh
|
|
116
135
|
docker pull ghcr.io/mermaid-js/mermaid-cli/mermaid-cli
|
|
117
136
|
```
|
|
118
137
|
|
|
@@ -127,9 +146,17 @@ diagram defined on your system in `/path/to/diagrams/diagram.mmd`, you can use
|
|
|
127
146
|
the container to generate an SVG file as follows:
|
|
128
147
|
|
|
129
148
|
```sh
|
|
130
|
-
docker run -
|
|
149
|
+
docker run --rm -u `id -u`:`id -g` -v /path/to/diagrams:/data minlag/mermaid-cli -i diagram.mmd
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
In previous version, the input files were mounted in `/home/mermaidcli`. You can
|
|
153
|
+
restore this behaviour with the `--workdir` option:
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
docker run [...] --workdir=/home/mermaidcli minlag/mermaid-cli [...]
|
|
131
157
|
```
|
|
132
158
|
|
|
159
|
+
|
|
133
160
|
## Use Node.JS API
|
|
134
161
|
|
|
135
162
|
It's possible to call `mermaid-cli` via a Node.JS API.
|
|
@@ -161,21 +188,6 @@ npm install @mermaid-js/mermaid-cli
|
|
|
161
188
|
./node_modules/.bin/mmdc -h
|
|
162
189
|
```
|
|
163
190
|
|
|
164
|
-
## Install globally
|
|
165
|
-
|
|
166
|
-
❗️ We do **NOT** recommend installing it globally because both YARN and NPM
|
|
167
|
-
could fail to install a command-line tool globally properly due to weird
|
|
168
|
-
permission issues.
|
|
169
|
-
`yarn global add @mermaid-js/mermaid-cli` or `npm install -g @mermaid-js/mermaid-cli`
|
|
170
|
-
|
|
171
|
-
## Install with [brew](https://brew.sh)
|
|
172
|
-
This method of installation is no longer supported.
|
|
173
|
-
For more details, see the [discussion](https://github.com/mermaid-js/mermaid-cli/issues/288).
|
|
174
|
-
An old version of mermaid-cli can be installed with brew.
|
|
175
|
-
```
|
|
176
|
-
brew install mermaid-cli
|
|
177
|
-
```
|
|
178
|
-
|
|
179
191
|
### Run with npx
|
|
180
192
|
|
|
181
193
|
[`npx`](https://www.npmjs.com/package/npx) is installed by default with NPM. It
|
|
@@ -183,6 +195,19 @@ downloads and runs commands at the same time. To use Mermaid CLI with npx, you
|
|
|
183
195
|
need to use the `-p` flag because the package name is different than the command
|
|
184
196
|
it installs (`mmdc`). `npx -p @mermaid-js/mermaid-cli mmdc -h`
|
|
185
197
|
|
|
198
|
+
|
|
199
|
+
## Install with [brew](https://brew.sh)
|
|
200
|
+
|
|
201
|
+
> **Warning**
|
|
202
|
+
>
|
|
203
|
+
> This method of installation is no longer supported.
|
|
204
|
+
> For more details, see the [discussion](https://github.com/mermaid-js/mermaid-cli/issues/288).
|
|
205
|
+
> An old version of mermaid-cli can be installed with brew.
|
|
206
|
+
> ```sh
|
|
207
|
+
> brew install mermaid-cli
|
|
208
|
+
> ```
|
|
209
|
+
|
|
210
|
+
|
|
186
211
|
## Known issues
|
|
187
212
|
|
|
188
213
|
1. [Linux sandbox issue](docs/linux-sandbox-issue.md)
|