Skip to content

Commit 5ccca5e

Browse files
authored
Merge pull request #17 from mermaid-js/develop
Merge
2 parents 9da8ea5 + 1c07e55 commit 5ccca5e

29 files changed

+2338
-2161
lines changed

.github/workflows/build.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
yarn config set cache-folder $GITHUB_WORKSPACE/.cache/yarn
3131
yarn install --frozen-lockfile
3232
env:
33-
CYPRESS_CACHE_FOLDER: ../../.cache/Cypress
33+
CYPRESS_CACHE_FOLDER: .cache/Cypress
3434

3535
- name: Run Build
3636
run: yarn build
37-
37+
3838
- name: Upload Build as Artifact
3939
uses: actions/upload-artifact@v1
4040
with:
@@ -44,21 +44,21 @@ jobs:
4444
- name: Run Unit Tests
4545
run: |
4646
yarn test --coverage
47-
47+
4848
- name: Upload Test Results
4949
uses: coverallsapp/github-action@v1.0.1
5050
with:
5151
github-token: ${{ secrets.GITHUB_TOKEN }}
5252
parallel: true
5353

54-
- name: Run E2E Tests
55-
run: yarn e2e
56-
env:
57-
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
58-
CYPRESS_CACHE_FOLDER: .cache/Cypress
59-
54+
# - name: Run E2E Tests
55+
# run: yarn e2e
56+
# env:
57+
# PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
58+
# CYPRESS_CACHE_FOLDER: .cache/Cypress
59+
6060
- name: Post Upload Test Results
6161
uses: coverallsapp/github-action@master
6262
with:
6363
github-token: ${{ secrets.GITHUB_TOKEN }}
64-
parallel-finished: true
64+
parallel-finished: true
File renamed without changes.

cypress/integration/rendering/flowchart.spec.js

+39-8
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ describe('Flowchart', () => {
512512
);
513513
});
514514

515-
it('24.1: Keep node label text (if already defined) when a style is applied', () => {
515+
it('24: Keep node label text (if already defined) when a style is applied', () => {
516516
imgSnapshotTest(
517517
`graph LR
518518
A(( )) -->|step 1| B(( ))
@@ -524,7 +524,7 @@ describe('Flowchart', () => {
524524
{ flowchart: { htmlLabels: false } }
525525
);
526526
});
527-
it('24.2: Handle link click events (link, anchor, mailto, other protocol, script)', () => {
527+
it('25: Handle link click events (link, anchor, mailto, other protocol, script)', () => {
528528
imgSnapshotTest(
529529
`graph TB
530530
TITLE["Link Click Events<br>(click the nodes below)"]
@@ -544,11 +544,15 @@ it('24.2: Handle link click events (link, anchor, mailto, other protocol, script
544544
);
545545
});
546546

547-
it('25: Set node text color according to style when html labels are enabled', () => {
547+
it('26: Set text color of nodes and links according to styles when html labels are enabled', () => {
548548
imgSnapshotTest(
549549
`graph LR
550-
A[red<br>text] --> B(blue<br>text)
551-
C[/red<br/>text/] --> D{blue<br/>text}
550+
A[red<br>text] -->|red<br>text| B(blue<br>text)
551+
C[/red<br/>text/] -->|blue<br/>text| D{blue<br/>text}
552+
E{{default<br />style}} -->|default<br />style| F([default<br />style])
553+
linkStyle default color:Sienna;
554+
linkStyle 0 color:red;
555+
linkStyle 1 stroke:DarkGray,stroke-width:2px,color:#0000ff
552556
style A color:red;
553557
style B color:blue;
554558
style C stroke:#ff0000,fill:#ffcccc,color:#ff0000
@@ -560,11 +564,15 @@ it('24.2: Handle link click events (link, anchor, mailto, other protocol, script
560564
);
561565
});
562566

563-
it('26: Set node text color according to style when html labels are disabled', () => {
567+
it('27: Set text color of nodes and links according to styles when html labels are disabled', () => {
564568
imgSnapshotTest(
565569
`graph LR
566-
A[red<br>text] --> B(blue<br>text)
567-
C[/red<br/>text/] --> D{blue<br/>text}
570+
A[red<br>text] -->|red<br>text| B(blue<br>text)
571+
C[/red<br/>text/] -->|blue<br/>text| D{blue<br/>text}
572+
E{{default<br />style}} -->|default<br />style| F([default<br />style])
573+
linkStyle default color:Sienna;
574+
linkStyle 0 color:red;
575+
linkStyle 1 stroke:DarkGray,stroke-width:2px,color:#0000ff
568576
style A color:red;
569577
style B color:blue;
570578
style C stroke:#ff0000,fill:#ffcccc,color:#ff0000
@@ -575,4 +583,27 @@ it('24.2: Handle link click events (link, anchor, mailto, other protocol, script
575583
{ flowchart: { htmlLabels: false } }
576584
);
577585
});
586+
it('30: Possibility to style text color of nodes and subgraphs as well as apply classes to subgraphs', () => {
587+
imgSnapshotTest(
588+
`graph LR
589+
subgraph id1 [title is set]
590+
A-->B
591+
end
592+
subgraph id2 [title]
593+
E
594+
end
595+
596+
B-->C
597+
598+
subgraph id3
599+
C-->D
600+
end
601+
class id3,id2,A redBg;
602+
class id3,A whiteTxt;
603+
classDef redBg fill:#622;
604+
classDef whiteTxt color: white;
605+
`,
606+
{ flowchart: { htmlLabels: false } }
607+
);
608+
});
578609
});

cypress/integration/rendering/gantt.spec.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -96,36 +96,36 @@ describe('Sequencediagram', () => {
9696
gantt
9797
excludes weekdays 2017-01-10
9898
title Projects Timeline
99-
99+
100100
section asdf
101101
specs :done, :ps, 2019-05-10, 50d
102102
Plasma :pc, 2019-06-20, 60d
103103
Rollup :or, 2019-08-20, 50d
104-
104+
105105
section CEL
106-
106+
107107
plasma-chamber :done, :pc, 2019-05-20, 60d
108108
Plasma Implementation (Rust) :por, 2019-06-20, 120d
109109
Predicates (Atomic Swap) :pred, 2019-07-20, 60d
110-
111-
section DEX 💰
112-
110+
111+
section DEX
112+
113113
History zkSNARK :hs, 2019-08-10, 40d
114114
Exit :vs, after hs, 60d
115115
PredicateSpec :ps, 2019-09-1, 20d
116116
PlasmaIntegration :pi, after ps,40d
117-
118-
119-
section Events 🏁
120-
117+
118+
119+
section Events
120+
121121
ETHBoston :done, :eb, 2019-09-08, 3d
122122
DevCon :active, :dc, 2019-10-08, 3d
123-
124-
section Plasma Calls & updates
123+
124+
section Plasma Calls & updates
125125
OVM :ovm, 2019-07-12, 120d
126126
Plasma call 26 :pc26, 2019-08-21, 1d
127127
Plasma call 27 :pc27, 2019-09-03, 1d
128-
Plasma call 28 :pc28, 2019-09-17, 1d
128+
Plasma call 28 :pc28, 2019-09-17, 1d
129129
`,
130130
{}
131131
);

cypress/integration/rendering/sequencediagram.spec.js

+33
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,38 @@ context('Sequence diagram', () => {
149149
{}
150150
);
151151
});
152+
it('should render autonumber when configured with such', () => {
153+
imgSnapshotTest(
154+
`
155+
sequenceDiagram
156+
Alice->>John: Hello John, how are you?
157+
loop Healthcheck
158+
John->>John: Fight against hypochondria
159+
end
160+
Note right of John: Rational thoughts!
161+
John-->>Alice: Great!
162+
John->>Bob: How about you?
163+
Bob-->>John: Jolly good!
164+
`,
165+
{sequence: { actorMargin: 50, showSequenceNumbers: true }}
166+
);
167+
});
168+
it('should render autonumber when autonumber keyword is used', () => {
169+
imgSnapshotTest(
170+
`
171+
sequenceDiagram
172+
autonumber
173+
Alice->>John: Hello John, how are you?
174+
loop Healthcheck
175+
John->>John: Fight against hypochondria
176+
end
177+
Note right of John: Rational thoughts!
178+
John-->>Alice: Great!
179+
John->>Bob: How about you?
180+
Bob-->>John: Jolly good!
181+
`,
182+
{}
183+
);
184+
});
152185
});
153186
});

cypress/platform/current.html

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
55
rel="stylesheet"
66
/>
7+
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
78
<style>
8-
body {background: white}
9+
body {
10+
background: white;
11+
font-family: 'Noto Sans SC', sans-serif;
12+
}
913
h1 { color: white;}
1014
.arrowheadPath {fill: red;}
1115

@@ -16,10 +20,15 @@
1620
<h1>info below</h1>
1721
<div style="display: flex;width: 100%; height: 100%">
1822
<div class="mermaid" style="width: 100%; height: 100%">
19-
stateDiagram
20-
21-
NotFound --> NotFound: Status
22-
NotFound --> NotFound: Stop
23+
sequenceDiagram
24+
Alice->>John: Hello John, how are you?
25+
loop Healthcheck
26+
John->>John: Fight against hypochondria
27+
end
28+
Note right of John: Rational thoughts!
29+
John-->>Alice: Great!
30+
John->>Bob: How about you?
31+
Bob-->>John: Jolly good!
2332

2433
</div>
2534
</div>
@@ -32,8 +41,9 @@ <h1>info below</h1>
3241
logLevel: 0,
3342
flowchart: { curve: 'linear', "htmlLabels": false },
3443
// gantt: { axisFormat: '%m/%d/%Y' },
35-
sequence: { actorMargin: 50 },
44+
sequence: { actorMargin: 50, showSequenceNumbers: true },
3645
// sequenceDiagram: { actorMargin: 300 } // deprecated
46+
fontFamily: '"Noto Sans SC", sans-serif'
3747
});
3848
</script>
3949
</script>

cypress/platform/e2e.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<head>
33
<script src="/e2e.js"></script>
44
<link href="https://fonts.googleapis.com/css?family=Mansalva&display=swap" rel="stylesheet" />
5+
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
56
<style>
67
body {
78
/* font-family: 'Mansalva', cursive;*/
@@ -32,7 +33,8 @@
3233
// "themeCSS": ":root { --mermaid-font-family: \"trebuchet ms\", verdana, arial;}",
3334
// fontFamily: '\"trebuchet ms\", verdana, arial;'
3435
// fontFamily: '"Comic Sans MS", "Comic Sans", cursive'
35-
fontFamily: '"Mansalva", cursive'
36+
// fontFamily: '"Mansalva", cursive',
37+
fontFamily: '"Noto Sans SC", sans-serif'
3638
});
3739
</script>
3840
</body>

dist/index.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,12 @@
371371
<hr/>
372372
<div class="mermaid">
373373
graph LR
374-
A[red<br>text] --> B(blue<br>text)
375-
C[/red<br/>text/] --> D{blue<br/>text}
374+
A[red<br>text] -->|red<br>text| B(blue<br>text)
375+
C[/red<br/>text/] -->|blue<br/>text| D{blue<br/>text}
376+
E{{default<br />style}} -->|default<br />style| F([default<br />style])
377+
linkStyle default color:Sienna;
378+
linkStyle 0 color:red;
379+
linkStyle 1 stroke:DarkGray,stroke-width:2px,color:#0000ff
376380
style A color:red;
377381
style B color:blue;
378382
style C stroke:#ff0000,fill:#ffcccc,color:#ff0000

docs/flowchart.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ Instead of ids, the order number of when the link was defined in the graph is us
497497
defined in the linkStyle statement will belong to the fourth link in the graph:
498498

499499
```
500-
linkStyle 3 stroke:#ff3,stroke-width:4px;
500+
linkStyle 3 stroke:#ff3,stroke-width:4px,color:red;
501501
```
502502

503503

docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta name="description" content="Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.">
88
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
99
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
10-
<script src="//cdn.jsdelivr.net/npm/mermaid@8.4.6/dist/mermaid.min.js"></script>
10+
<script src="//cdn.jsdelivr.net/npm/mermaid@8.4.7/dist/mermaid.min.js"></script>
1111
<script>
1212
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1313
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

docs/sequenceDiagram.md

+39-2
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,46 @@ sequenceDiagram
282282
John-->>Alice: Great!
283283
```
284284

285+
## sequenceNumbers
286+
287+
It is possiebl to get a sequence number attached to each arrow in a sequence diagram. This can be configured when adding mermaid to the website as shown below:
288+
```
289+
<script>
290+
mermaid.initialize({
291+
sequence: { showSequenceNumbers: true },
292+
});
293+
</script>
294+
```
295+
296+
It can also be be turned on via the diagram code as in the diagram:
297+
```
298+
sequenceDiagram
299+
autonumber
300+
Alice->>John: Hello John, how are you?
301+
loop Healthcheck
302+
John->>John: Fight against hypochondria
303+
end
304+
Note right of John: Rational thoughts!
305+
John-->>Alice: Great!
306+
John->>Bob: How about you?
307+
Bob-->>John: Jolly good!
308+
```
309+
```mermaid
310+
sequenceDiagram
311+
autonumber
312+
Alice->>John: Hello John, how are you?
313+
loop Healthcheck
314+
John->>John: Fight against hypochondria
315+
end
316+
Note right of John: Rational thoughts!
317+
John-->>Alice: Great!
318+
John->>Bob: How about you?
319+
Bob-->>John: Jolly good!
320+
```
321+
285322
## Styling
286323

287-
Styling of the a sequence diagram is done by defining a number of css classes. During rendering these classes are extracted from the file located at src/themes/sequence.scss
324+
Styling of a sequence diagram is done by defining a number of css classes. During rendering these classes are extracted from the file located at src/themes/sequence.scss
288325

289326
### Classes used
290327

@@ -414,5 +451,5 @@ mermaid.sequenceConfig = {
414451
Param | Description | Default value
415452
--- | --- | ---
416453
mirrorActor | Turns on/off the rendering of actors below the diagram as well as above it | false
417-
bottomMarginAdj | Adjusts how far down the graph ended. Wide borders styles with css could generate unwantewd clipping which is why this config param exists. | 1
454+
bottomMarginAdj | Adjusts how far down the graph ended. Wide borders styles with css could generate unwanted clipping which is why this config param exists. | 1
418455

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mermaid",
3-
"version": "8.4.6",
3+
"version": "8.4.7",
44
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
55
"main": "dist/mermaid.core.js",
66
"keywords": [
@@ -60,16 +60,16 @@
6060
},
6161
"devDependencies": {
6262
"@babel/core": "^7.2.2",
63-
"@babel/preset-env": "^7.2.0",
63+
"@babel/preset-env": "^7.8.4",
6464
"@babel/register": "^7.0.0",
65-
"@percy/cypress": "^2.0.1",
65+
"@percy/cypress": "*",
6666
"babel-core": "7.0.0-bridge.0",
6767
"babel-jest": "^24.9.0",
6868
"babel-loader": "^8.0.4",
6969
"coveralls": "^3.0.2",
7070
"css-loader": "^2.0.1",
7171
"css-to-string-loader": "^0.1.3",
72-
"cypress": "3.4.0",
72+
"cypress": "4.0.1",
7373
"documentation": "^12.0.1",
7474
"eslint": "^6.3.0",
7575
"eslint-config-prettier": "^6.3.0",

0 commit comments

Comments
 (0)