UNPKG

4.74 kBMarkdownView Raw
1# mermaid
2
3[![Build Status](https://travis-ci.org/knsv/mermaid.svg?branch=master)](https://travis-ci.org/knsv/mermaid)
4[![Coverage Status](https://coveralls.io/repos/github/knsv/mermaid/badge.svg?branch=master)](https://coveralls.io/github/knsv/mermaid?branch=master)
5[![Join the chat at https://gitter.im/knsv/mermaid](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/knsv/mermaid?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
7![banner](./img/header.png)
8
9Generation of diagrams and flowcharts from text in a similar manner as markdown.
10
11Ever wanted to simplify documentation and avoid heavy tools like Visio when explaining your code?
12
13This is why mermaid was born, a simple markdown-like script language for generating charts from text via javascript.
14
15
16### Flowchart
17
18```
19graph TD;
20 A-->B;
21 A-->C;
22 B-->D;
23 C-->D;
24```
25![Flowchart](./img/flow.png)
26
27
28### Sequence diagram
29
30```
31sequenceDiagram
32 participant Alice
33 participant Bob
34 Alice->>John: Hello John, how are you?
35 loop Healthcheck
36 John->>John: Fight against hypochondria
37 end
38 Note right of John: Rational thoughts <br/>prevail...
39 John-->>Alice: Great!
40 John->>Bob: How about you?
41 Bob-->>John: Jolly good!
42```
43![Sequence diagram](./img/sequence.png)
44
45
46### Gantt diagram
47
48```
49gantt
50dateFormat YYYY-MM-DD
51title Adding GANTT diagram to mermaid
52
53section A section
54Completed task :done, des1, 2014-01-06,2014-01-08
55Active task :active, des2, 2014-01-09, 3d
56Future task : des3, after des2, 5d
57Future task2 : des4, after des3, 5d
58```
59![Gantt diagram](./img/gantt.png)
60
61
62### Class diagram - :exclamation: experimental
63
64```
65classDiagram
66Class01 <|-- AveryLongClass : Cool
67Class03 *-- Class04
68Class05 o-- Class06
69Class07 .. Class08
70Class09 --> C2 : Where am i?
71Class09 --* C3
72Class09 --|> Class07
73Class07 : equals()
74Class07 : Object[] elementData
75Class01 : size()
76Class01 : int chimp
77Class01 : int gorilla
78Class08 <--> C2: Cool label
79```
80![Class diagram](./img/class.png)
81
82
83### Git graph - :exclamation: experimental
84
85```
86gitGraph:
87options
88{
89 "nodeSpacing": 150,
90 "nodeRadius": 10
91}
92end
93commit
94branch newbranch
95checkout newbranch
96commit
97commit
98checkout master
99commit
100commit
101merge newbranch
102
103```
104
105![Git graph](./img/git.png)
106
107
108## Installation
109
110### CDN
111
112```
113https://unpkg.com/mermaid@<version>/dist/
114```
115
116Replace `<version>` with expected version number.
117
118Example: https://unpkg.com/mermaid@7.1.0/dist/
119
120### Node.js
121
122```
123yarn add mermaid
124```
125
126
127## Documentation
128
129https://mermaidjs.github.io
130
131
132## Sibling projects
133
134- [mermaid CLI](https://github.com/mermaidjs/mermaid.cli)
135- [mermaid live editor](https://github.com/mermaidjs/mermaid-live-editor)
136- [mermaid webpack demo](https://github.com/mermaidjs/mermaid-webpack-demo)
137- [mermaid Parcel demo](https://github.com/mermaidjs/mermaid-parcel-demo)
138
139
140# Request for assistance
141
142Things are piling up and I have hard time keeping up. To remedy this
143it would be great if we could form a core team of developers to cooperate
144with the future development mermaid.
145
146As part of this team you would get write access to the repository and would
147represent the project when answering questions and issues.
148
149Together we could continue the work with things like:
150* adding more typers of diagrams like mindmaps, ert digrams etc
151* improving existing diagrams
152
153Don't hesitate to contact me if you want to get involved.
154
155
156# For contributors
157
158## Setup
159
160 yarn install
161
162
163## Build
164
165 yarn build:watch
166
167
168## Lint
169
170 yarn lint
171
172We use [JavaScript Standard Style](https://github.com/feross/standard).
173We recommend you installing [editor plugins](https://github.com/feross/standard#are-there-text-editor-plugins) so you can get real time lint result.
174
175
176## Test
177
178 yarn test
179
180Manual test in browser:
181
182 open dist/index.html
183
184
185## Release
186
187For those who have the permission to do so:
188
189Update version number in `package.json`.
190
191 npm publish
192
193Command above generates files into the `dist` folder and publishes them to npmjs.org.
194
195
196# Credits
197
198Many thanks to the [d3](http://d3js.org/) and [dagre-d3](https://github.com/cpettitt/dagre-d3) projects for providing the graphical layout and drawing libraries!
199
200Thanks also to the [js-sequence-diagram](http://bramp.github.io/js-sequence-diagrams) project for usage of the grammar for the sequence diagrams. Thanks to Jessica Peter for inspiration and starting point for gantt rendering.
201
202*Mermaid was created by Knut Sveidqvist for easier documentation.*
203
204*[Tyler Long](https://github.com/tylerlong) has became a collaborator since April 2017.*
205
206Here is the full list of the projects [contributors](https://github.com/knsv/mermaid/graphs/contributors).