Skip to content

Commit ccfc735

Browse files
authored
Merge pull request #18 from mermaid-js/develop
Merge
2 parents 5ccca5e + df6c5dd commit ccfc735

26 files changed

+501
-160
lines changed

README.md

+37-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,46 @@
55
<!-- </Remove this in the future> -->
66

77
# mermaid [![Build Status](https://travis-ci.org/mermaid-js/mermaid.svg?branch=master)](https://travis-ci.org/mermaid-js/mermaid) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/Mermaid/mermaid)
8+
89
<!-- <Main description> -->
9-
__Generate diagrams, charts, graphs or flows from markdown-like text via javascript.__
10-
See our [documentation](http://mermaid-js.github.io/mermaid/) and start simplifying yours. Play in our [live editor](https://mermaidjs.github.io/mermaid-live-editor/) or jump straight to the [installation and usage](http://mermaid-js.github.io/mermaid/#/usage).
11-
<!-- </Main description> -->
10+
__mermaid is a Javascript based diagramming and charting tool. It generates diagrams flowcharts and more, using markdown-inspired text for ease and speed.__
11+
12+
Check out the list of [Integrations and Usages of Mermaid](https://github.com/mermaid-js/mermaid/blob/develop/docs/integrations.md)
13+
14+
For more information and help in getting started, please view our [documentation](http://mermaid-js.github.io/mermaid/) and start simplifying yours. Alternatively, you can also play with our [live editor](https://mermaidjs.github.io/mermaid-live-editor/).
15+
<!-- </Main description> -->
16+
17+
:trophy: **Mermaid was nominated and won the [JS Open Source Awards (2019)](https://osawards.com/javascript/#nominees) in the category "The most exciting use of technology"!!! Thanks to all involved, people committing pull requests, people answering questions and special thanks to Tyler Long who is helping me maintain the project.**
18+
19+
## New diagrams in 8.4
20+
21+
With version 8.4 class diagrams have got some new features, bug fixes and documentation. Another new feature in 8.4 is the new diagram type, state diagrams.
22+
23+
![Image show the two new diagram types](.docs/img/new-diagrams.png)
1224

13-
:trophy: _"The most exciting use of technology"_ - [JS Open Source Awards (2019)](https://osawards.com/javascript/#nominees)
25+
## Special note regarding version 8.2
26+
27+
In version 8.2 a security improvement was introduced. A securityLevel configuration was introduced which sets the level of trust to be used on the parsed diagrams.
28+
29+
- **true**: (default) tags in text are encoded, click functionality is disabled
30+
- false: tags in text are allowed, click functionality is enabled
31+
32+
Closed issues:
33+
34+
⚠️ **Note** : This changes the default behaviour of mermaid so that after upgrade to 8.2, if the securityLevel is not configured, tags in flowcharts are encoded as tags and clicking is prohibited.
35+
36+
If your application is taking resposibility for the diagram source security you can set the securityLevel accordingly. By doing this clicks and tags are again allowed.
37+
38+
```javascript
39+
mermaidAPI.initialize({
40+
securityLevel: 'loose'
41+
});
42+
```
43+
44+
For more information and help in getting started, please view our [documentation](http://mermaid-js.github.io/mermaid/) and start simplifying yours. Play with our [live editor](https://mermaidjs.github.io/mermaid-live-editor/) or jump straight to the [installation and usage](http://mermaid-js.github.io/mermaid/#/usage).
45+
<!-- </Main description> -->
1446

47+
__The following are some examples of the diagrams, charts and graphs that can be made using mermaid and the Markdown-inspired text specific to it. Click here jump into the [text syntax](https://mermaid-js.github.io/mermaid/#/n00b-syntaxReference).__
1548
<table>
1649
<!-- <Flowchart> -->
1750
<tr><td colspan=2 align="center">

cypress/integration/rendering/flowchart.spec.js

+35-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ describe('Flowchart', () => {
524524
{ flowchart: { htmlLabels: false } }
525525
);
526526
});
527-
it('25: Handle link click events (link, anchor, mailto, other protocol, script)', () => {
527+
528+
it('25: Handle link click events (link, anchor, mailto, other protocol, script)', () => {
528529
imgSnapshotTest(
529530
`graph TB
530531
TITLE["Link Click Events<br>(click the nodes below)"]
@@ -583,6 +584,39 @@ it('25: Handle link click events (link, anchor, mailto, other protocol, script)'
583584
{ flowchart: { htmlLabels: false } }
584585
);
585586
});
587+
588+
it('28: Apply default class to all nodes which do not have another class assigned (htmlLabels enabled)', () => {
589+
imgSnapshotTest(
590+
`graph TD
591+
A[myClass1] --> B[default] & C[default]
592+
B[default] & C[default] --> D[myClass2]
593+
classDef default stroke-width:2px,fill:none,stroke:silver
594+
classDef node color:red
595+
classDef myClass1 color:#0000ff
596+
classDef myClass2 stroke:#0000ff,fill:#ccccff
597+
class A myClass1
598+
class D myClass2
599+
`,
600+
{ flowchart: { htmlLabels: true } }
601+
);
602+
});
603+
604+
it('29: Apply default class to all nodes which do not have another class assigned (htmlLabels disabled)', () => {
605+
imgSnapshotTest(
606+
`graph TD
607+
A[myClass1] --> B[default] & C[default]
608+
B[default] & C[default] --> D[myClass2]
609+
classDef default stroke-width:2px,fill:none,stroke:silver
610+
classDef node color:red
611+
classDef myClass1 color:#0000ff
612+
classDef myClass2 stroke:#0000ff,fill:#ccccff
613+
class A myClass1
614+
class D myClass2
615+
`,
616+
{ flowchart: { htmlLabels: false } }
617+
);
618+
});
619+
586620
it('30: Possibility to style text color of nodes and subgraphs as well as apply classes to subgraphs', () => {
587621
imgSnapshotTest(
588622
`graph LR

dist/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,17 @@
384384
click B "index.html#link-clicked" "link test"
385385
click D testClick "click test"
386386
</div>
387+
<div class="mermaid">
388+
graph TD
389+
A[myClass1] --> B[default] & C[default]
390+
B[default] & C[default] --> D[myClass2]
391+
classDef default stroke-width:2px,fill:none,stroke:silver
392+
classDef node color:red
393+
classDef myClass1 color:#0000ff
394+
classDef myClass2 stroke:#0000ff,fill:#ccccff
395+
class A myClass1
396+
class D myClass2
397+
</div>
387398

388399
<hr/>
389400

docs/README.md

+53-54
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
# Mermaid
2+
13
[![Build Status](https://travis-ci.org/mermaid-js/mermaid.svg?branch=master)](https://travis-ci.org/mermaid-js/mermaid)
24
[![Coverage Status](https://coveralls.io/repos/github/knsv/mermaid/badge.svg?branch=master)](https://coveralls.io/github/knsv/mermaid?branch=master)
35
[![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)
46

5-
# mermaid
7+
![banner](./img/header.png)
8+
9+
Generation of diagrams and flowcharts from text in a similar manner as markdown.
10+
11+
Ever wanted to simplify documentation and avoid heavy tools like Visio when explaining your code?
12+
13+
This is why mermaid was born, a simple markdown-like script language for generating charts from text via javascript.
14+
15+
Check out the list of [Integrations and Usages of Mermaid](./integrations.md)
16+
17+
**Mermaid was nominated and won the JS Open Source Awards (2019) in the category "The most exciting use of technology"!!! Thanks to all involved, people committing pull requests, people answering questions and special thanks to Tyler Long who is helping me maintain the project.**
618

719
## New diagrams in 8.4
820

9-
With version 8.4 class diagrams has got some new features, bug fixes and documentation. Another new feature in 8.4 is the new diagram
10-
type, state diagrams.
21+
With version 8.4 class diagrams have got some new features, bug fixes and documentation. Another new feature in 8.4 is the new diagram type, state diagrams.
1122

1223
![Image show the two new diagram types](./img/new-diagrams.png)
1324

14-
1525
## Special note regarding version 8.2
1626

1727
In version 8.2 a security improvement was introduced. A securityLevel configuration was introduced which sets the level of trust to be used on the parsed diagrams.
1828

19-
* **true**: (default) tags in text are encoded, click functionality is disabled
20-
* false: tags in text are allowed, click functionality is enabled
29+
- **true**: (default) tags in text are encoded, click functionality is disabled
30+
- false: tags in text are allowed, click functionality is enabled
2131

2232
Closed issues:
2333

@@ -26,22 +36,14 @@ Closed issues:
2636
If your application is taking resposibility for the diagram source security you can set the securityLevel accordingly. By doing this clicks and tags are again allowed.
2737

2838
```javascript
29-
mermaidAPI.initialize({
30-
securityLevel: 'loose'
31-
});
39+
mermaidAPI.initialize({
40+
securityLevel: 'loose'
41+
});
3242
```
3343

3444
**🖖 Keep a steady pulse: mermaid needs more Collaborators [#866](https://github.com/knsv/mermaid/issues/866)**
3545

36-
![banner](./img/header.png)
37-
38-
Generation of diagrams and flowcharts from text in a similar manner as markdown.
39-
40-
Ever wanted to simplify documentation and avoid heavy tools like Visio when explaining your code?
41-
42-
This is why mermaid was born, a simple markdown-like script language for generating charts from text via javascript.
43-
44-
**Mermaid was nominated and won the JS Open Source Awards (2019) in the category "The most exciting use of technology"!!! Thanks to all involved, people committing pull requests, people answering questions and special thanks to Tyler Long who is helping me maintain the project.**
46+
## Diagrams
4547

4648
### Flowchart
4749

@@ -52,8 +54,8 @@ graph TD;
5254
B-->D;
5355
C-->D;
5456
```
55-
![Flowchart](./img/flow.png)
5657

58+
![Flowchart](./img/flow.png)
5759

5860
### Sequence diagram
5961

@@ -70,8 +72,8 @@ sequenceDiagram
7072
John->>Bob: How about you?
7173
Bob-->>John: Jolly good!
7274
```
73-
![Sequence diagram](./img/sequence.png)
7475

76+
![Sequence diagram](./img/sequence.png)
7577

7678
### Gantt diagram
7779

@@ -87,8 +89,8 @@ Active task :active, des2, 2014-01-09, 3d
8789
Future task : des3, after des2, 5d
8890
Future task2 : des4, after des3, 5d
8991
```
90-
![Gantt diagram](./img/gantt.png)
9192

93+
![Gantt diagram](./img/gantt.png)
9294

9395
### Class diagram - :exclamation: experimental
9496

@@ -108,8 +110,8 @@ Class01 : int chimp
108110
Class01 : int gorilla
109111
Class08 <--> C2: Cool label
110112
```
111-
![Class diagram](./img/class.png)
112113

114+
![Class diagram](./img/class.png)
113115

114116
### Git graph - :exclamation: experimental
115117

@@ -135,7 +137,6 @@ merge newbranch
135137

136138
![Git graph](./img/git.png)
137139

138-
139140
## Installation
140141

141142
### CDN
@@ -154,21 +155,18 @@ Example: https://unpkg.com/mermaid@7.1.0/dist/
154155
yarn add mermaid
155156
```
156157

157-
158158
## Documentation
159159

160160
https://mermaidjs.github.io
161161

162-
163162
## Sibling projects
164163

165164
- [mermaid CLI](https://github.com/mermaidjs/mermaid.cli)
166165
- [mermaid live editor](https://github.com/mermaidjs/mermaid-live-editor)
167166
- [mermaid webpack demo](https://github.com/mermaidjs/mermaid-webpack-demo)
168167
- [mermaid Parcel demo](https://github.com/mermaidjs/mermaid-parcel-demo)
169168

170-
171-
# Request for assistance
169+
## Request for assistance
172170

173171
Things are piling up and I have a hard time keeping up. To remedy this
174172
it would be great if we could form a core team of developers to cooperate
@@ -178,61 +176,62 @@ As part of this team you would get write access to the repository and would
178176
represent the project when answering questions and issues.
179177

180178
Together we could continue the work with things like:
181-
* adding more types of diagrams like mindmaps, ert diagrams, etc.
182-
* improving existing diagrams
183179

184-
Don't hesitate to contact me if you want to get involved.
180+
- Adding more types of diagrams like mindmaps, ert diagrams, etc.
181+
- Improving existing diagrams
185182

183+
Don't hesitate to contact me if you want to get involved.
186184

187-
# For contributors
188-
189-
## Setup
190-
191-
yarn install
185+
## For contributors
192186

187+
### Setup
193188

194-
## Build
189+
```
190+
yarn install
191+
```
195192

196-
yarn build:watch
193+
### Build
197194

195+
```
196+
yarn build:watch
197+
```
198198

199-
## Lint
199+
### Lint
200200

201-
yarn lint
201+
```
202+
yarn lint
203+
```
202204

203205
We use [eslint](https://eslint.org/).
204206
We recommend you installing [editor plugins](https://eslint.org/docs/user-guide/integrations) so you can get real time lint result.
205207

208+
### Test
206209

210+
```
211+
yarn test
212+
```
213+
Manual test in browser: open `dist/index.html`
207214

208-
## Test
209-
210-
yarn test
211-
212-
Manual test in browser:
213-
214-
open dist/index.html
215-
216-
217-
## Release
215+
### Release
218216

219217
For those who have the permission to do so:
220218

221219
Update version number in `package.json`.
222220

223-
npm publish
221+
```
222+
npm publish
223+
```
224224

225225
Command above generates files into the `dist` folder and publishes them to npmjs.org.
226226

227-
228-
# Credits
227+
## Credits
229228

230229
Many 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!
231230

232231
Thanks 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.
233232

234-
*Mermaid was created by Knut Sveidqvist for easier documentation.*
233+
_Mermaid was created by Knut Sveidqvist for easier documentation._
235234

236-
*[Tyler Long](https://github.com/tylerlong) has became a collaborator since April 2017.*
235+
_[Tyler Long](https://github.com/tylerlong) has became a collaborator since April 2017._
237236

238237
Here is the full list of the projects [contributors](https://github.com/knsv/mermaid/graphs/contributors).

docs/development.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,31 @@
33

44
## Updating the documentation
55

6-
We write documention with GitBook.
6+
Please continue writing documentation at [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs).
77

8-
Please continue with the [mermaid-gitbook](https://github.com/mermaidjs/mermaid-gitbook) project.
8+
We publish documentation using GitHub Pages.
9+
10+
11+
### Questions and/or suggestions ?
12+
After logging in at [GitHub.com](https://www.github.com), open or append to an issue [using the GitHub issue tracker of the mermaid-js repository](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Area%3A+Documentation%22).
13+
14+
### How to contribute a suggestion
15+
Markdown is used to format the text, for more information about Markdown [see the GitHub Markdown help page](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax).
16+
17+
If you want to use an editor on your own computer, you may follow these steps:
18+
* Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs) directory on the develop branch.
19+
* Create a fork of the develop branch.
20+
* Make changes or add new documentation.
21+
* Commit changes to your fork and push it to GitHub.
22+
* Create a pull request of your fork.
23+
24+
If you don't have such editor on your computer, you may follow these steps:
25+
* Login at [GitHub.com](https://www.github.com).
26+
* Navigate to [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs).
27+
* To edit a file, click the pencil icon at the top-right of the file contents panel.
28+
* Describe what you changed in the "Propose file change" section, located at the bottom of the page.
29+
* Submit your changes by clicking the button "Propose file change" at the bottom (by automatic creation of a fork and a new branch).
30+
* Create a pull request of your newly forked branch, by clicking the green "Create pull request" button.
931

1032

1133
## How to add a new diagram type

docs/img/liveEditorOptions.png

102 KB
Loading

0 commit comments

Comments
 (0)