Skip to content

Commit 5ed1555

Browse files
committed
Merge branch 'develop' into sidv/removeDirectiveGrammar
* develop: (31 commits) chore: Update docs New Mermaid Live Editor for Confluence Cloud (mermaid-js#4814) Update link to Discourse theme component (mermaid-js#4811) Update flowchart.md (mermaid-js#4810) chore: Update docs "CSS" instead of "css" in flowchart.md (mermaid-js#4797) Update CONTRIBUTING.md Update CONTRIBUTING.md fix: typos (mermaid-js#4801) chore: Align with convention add additional test case chore(deps): update all patch dependencies chore(deps): update all minor dependencies added test case add sanitize text Update docs modifications to generic parser improvements to parseGenericTypes Update packages/mermaid/src/diagrams/class/svgDraw.js return comment ...
2 parents 066e096 + 3959e07 commit 5ed1555

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1372
-789
lines changed

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Documentation is necessary for all non bugfix/refactoring changes.
7171

7272
Only make changes to files that are in [`/packages/mermaid/src/docs`](packages/mermaid/src/docs)
7373

74-
**_DO NOT CHANGE FILES IN `/docs`_**
74+
**_DO NOT CHANGE FILES IN `/docs` MANUALLY_**
75+
76+
The `/docs` folder will be rebuilt and committed as part of a pre-commit hook.
7577

7678
[Join our slack community if you want closer contact!](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)

cSpell.json

+3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838
"docsy",
3939
"doku",
4040
"dompurify",
41+
"dont",
42+
"doublecircle",
4143
"edgechromium",
44+
"elems",
4245
"elkjs",
4346
"elle",
4447
"faber",

cypress/integration/rendering/classDiagram-v2.spec.js

+17-8
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,11 @@ describe('Class diagram V2', () => {
386386
{ logLevel: 1, flowchart: { htmlLabels: false } }
387387
);
388388
});
389-
390-
it('18: should handle the direction statement with LR', () => {
389+
it('17a: should handle the direction statement with BT', () => {
391390
imgSnapshotTest(
392391
`
393392
classDiagram
394-
direction LR
393+
direction BT
395394
class Student {
396395
-idCard : IdCard
397396
}
@@ -410,11 +409,11 @@ describe('Class diagram V2', () => {
410409
{ logLevel: 1, flowchart: { htmlLabels: false } }
411410
);
412411
});
413-
it('17a: should handle the direction statement with BT', () => {
412+
it('17b: should handle the direction statement with RL', () => {
414413
imgSnapshotTest(
415414
`
416415
classDiagram
417-
direction BT
416+
direction RL
418417
class Student {
419418
-idCard : IdCard
420419
}
@@ -433,11 +432,12 @@ describe('Class diagram V2', () => {
433432
{ logLevel: 1, flowchart: { htmlLabels: false } }
434433
);
435434
});
436-
it('17b: should handle the direction statement with RL', () => {
435+
436+
it('18a: should handle the direction statement with LR', () => {
437437
imgSnapshotTest(
438438
`
439439
classDiagram
440-
direction RL
440+
direction LR
441441
class Student {
442442
-idCard : IdCard
443443
}
@@ -457,7 +457,7 @@ describe('Class diagram V2', () => {
457457
);
458458
});
459459

460-
it('18: should render a simple class diagram with notes', () => {
460+
it('18b: should render a simple class diagram with notes', () => {
461461
imgSnapshotTest(
462462
`
463463
classDiagram-v2
@@ -562,4 +562,13 @@ class C13["With Città foreign language"]
562562
`
563563
);
564564
});
565+
it('should render a simple class diagram with no members', () => {
566+
imgSnapshotTest(
567+
`
568+
classDiagram-v2
569+
class Class10
570+
`,
571+
{ logLevel: 1, flowchart: { htmlLabels: false } }
572+
);
573+
});
565574
});

demos/classchart.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ <h1>Class diagram demos</h1>
3838
+quack()
3939
}
4040
class Fish{
41-
-int sizeInFeet
41+
-Listint sizeInFeet
4242
-canEat()
4343
}
4444
class Zebra{
4545
+bool is_wild
46-
+run()
46+
+run(List~T~, List~OT~)
47+
%% +run-composite(List~T, K~)
48+
+run-nested(List~List~OT~~)
4749
}
4850

4951
</pre>
@@ -80,6 +82,7 @@ <h1>Class diagram demos</h1>
8082
Class01 : #size()
8183
Class01 : -int chimp
8284
Class01 : +int gorilla
85+
Class01 : +abstractAttribute string*
8386
class Class10~T~ {
8487
&lt;&lt;service&gt;&gt;
8588
int id
@@ -122,6 +125,8 @@ <h1>Class diagram demos</h1>
122125
classDiagram
123126
direction LR
124127
Animal ()-- Dog
128+
Animal ()-- Cat
129+
note for Cat "should have no members area"
125130
Dog : bark()
126131
Dog : species()
127132
</pre>
@@ -151,6 +156,7 @@ <h1>Class diagram demos</h1>
151156
~InternalProperty : string
152157
~AnotherInternalProperty : List~List~string~~
153158
}
159+
class People List~List~Person~~
154160
</pre>
155161
<hr />
156162

docs/community/code.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Once the release happens we add a tag to the `release` branch and merge it with
4242
2. Check out the `develop` branch
4343
3. Create a new branch for your work. Please name the branch following our naming convention below.
4444

45-
We use the follow naming convention for branches:
45+
We use the following naming convention for branches:
4646

4747
```txt
4848
[feature | bug | chore | docs]/[issue number]_[short description using dashes ('-') or underscores ('_') instead of spaces]

docs/community/development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In GitHub, you first **fork** a repository when you are going to make changes an
2222

2323
Then you **clone** a copy to your local development machine (e.g. where you code) to make a copy with all the files to work with.
2424

25-
[Fork mermaid](https://github.com/mermaid-js/mermaid/fork) to start contributing to the main project and its documentaion, or [search for other repositories](https://github.com/orgs/mermaid-js/repositories).
25+
[Fork mermaid](https://github.com/mermaid-js/mermaid/fork) to start contributing to the main project and its documentation, or [search for other repositories](https://github.com/orgs/mermaid-js/repositories).
2626

2727
[Here is a GitHub document that gives an overview of the process.](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
2828

docs/community/docker-development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In GitHub, you first **fork** a repository when you are going to make changes an
2222

2323
Then you **clone** a copy to your local development machine (e.g. where you code) to make a copy with all the files to work with.
2424

25-
[Fork mermaid](https://github.com/mermaid-js/mermaid/fork) to start contributing to the main project and its documentaion, or [search for other repositories](https://github.com/orgs/mermaid-js/repositories).
25+
[Fork mermaid](https://github.com/mermaid-js/mermaid/fork) to start contributing to the main project and its documentation, or [search for other repositories](https://github.com/orgs/mermaid-js/repositories).
2626

2727
[Here is a GitHub document that gives an overview of the process.](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
2828

docs/community/newDiagram.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For instance:
1919

2020
#### Store data found during parsing
2121

22-
There are some jison specific sub steps here where the parser stores the data encountered when parsing the diagram, this data is later used by the renderer. You can during the parsing call a object provided to the parser by the user of the parser. This object can be called during parsing for storing data.
22+
There are some jison specific sub steps here where the parser stores the data encountered when parsing the diagram, this data is later used by the renderer. You can during the parsing call an object provided to the parser by the user of the parser. This object can be called during parsing for storing data.
2323

2424
```jison
2525
statement
@@ -35,7 +35,7 @@ In the extract of the grammar above, it is defined that a call to the setTitle m
3535
> **Note**
3636
> Make sure that the `parseError` function for the parser is defined and calling `mermaid.parseError`. This way a common way of detecting parse errors is provided for the end-user.
3737
38-
For more info look in the example diagram type:
38+
For more info look at the example diagram type:
3939

4040
The `yy` object has the following function:
4141

@@ -54,15 +54,15 @@ parser.yy = db;
5454

5555
### Step 2: Rendering
5656

57-
Write a renderer that given the data found during parsing renders the diagram. To look at an example look at sequenceRenderer.js rather then the flowchart renderer as this is a more generic example.
57+
Write a renderer that given the data found during parsing renders the diagram. To look at an example look at sequenceRenderer.js rather than the flowchart renderer as this is a more generic example.
5858

5959
Place the renderer in the diagram folder.
6060

6161
### Step 3: Detection of the new diagram type
6262

6363
The second thing to do is to add the capability to detect the new diagram to type to the detectType in `diagram-api/detectType.ts`. The detection should return a key for the new diagram type.
6464
[This key will be used to as the aria roledescription](#aria-roledescription), so it should be a word that clearly describes the diagram type.
65-
For example, if your new diagram use a UML deployment diagram, a good key would be "UMLDeploymentDiagram" because assistive technologies such as a screen reader
65+
For example, if your new diagram uses a UML deployment diagram, a good key would be "UMLDeploymentDiagram" because assistive technologies such as a screen reader
6666
would voice that as "U-M-L Deployment diagram." Another good key would be "deploymentDiagram" because that would be voiced as "Deployment Diagram." A bad key would be "deployment" because that would not sufficiently describe the diagram.
6767

6868
Note that the diagram type key does not have to be the same as the diagram keyword chosen for the [grammar](#grammar), but it is helpful if they are the same.
@@ -122,7 +122,7 @@ There are a few features that are common between the different types of diagrams
122122
- Themes, there is a common way to modify the styling of diagrams in Mermaid.
123123
- Comments should follow mermaid standards
124124

125-
Here some pointers on how to handle these different areas.
125+
Here are some pointers on how to handle these different areas.
126126

127127
## Accessibility
128128

@@ -140,7 +140,7 @@ See [the definition of aria-roledescription](https://www.w3.org/TR/wai-aria-1.1/
140140

141141
### accessible title and description
142142

143-
The syntax for accessible titles and descriptions is described in [the Accessibility documenation section.](../config/accessibility.md)
143+
The syntax for accessible titles and descriptions is described in [the Accessibility documentation section.](../config/accessibility.md)
144144

145145
As a design goal, the jison syntax should be similar between the diagrams.
146146

docs/config/directives.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ The following code snippet changes `theme` to `forest`:
126126

127127
`%%{init: { "theme": "forest" } }%%`
128128

129-
Possible theme values are: `default`,`base`, `dark`, `forest` and `neutral`.
129+
Possible theme values are: `default`, `base`, `dark`, `forest` and `neutral`.
130130
Default Value is `default`.
131131

132132
Example:
@@ -291,7 +291,7 @@ Let us see an example:
291291
sequenceDiagram
292292
293293
Alice->Bob: Hello Bob, how are you?
294-
Bob->Alice: Fine, how did you mother like the book I suggested? And did you catch the new book about alien invasion?
294+
Bob->Alice: Fine, how did your mother like the book I suggested? And did you catch the new book about alien invasion?
295295
Alice->Bob: Good.
296296
Bob->Alice: Cool
297297
```
@@ -300,7 +300,7 @@ Bob->Alice: Cool
300300
sequenceDiagram
301301
302302
Alice->Bob: Hello Bob, how are you?
303-
Bob->Alice: Fine, how did you mother like the book I suggested? And did you catch the new book about alien invasion?
303+
Bob->Alice: Fine, how did your mother like the book I suggested? And did you catch the new book about alien invasion?
304304
Alice->Bob: Good.
305305
Bob->Alice: Cool
306306
```
@@ -317,7 +317,7 @@ By applying that snippet to the diagram above, `wrap` will be enabled:
317317
%%{init: { "sequence": { "wrap": true, "width":300 } } }%%
318318
sequenceDiagram
319319
Alice->Bob: Hello Bob, how are you?
320-
Bob->Alice: Fine, how did you mother like the book I suggested? And did you catch the new book about alien invasion?
320+
Bob->Alice: Fine, how did your mother like the book I suggested? And did you catch the new book about alien invasion?
321321
Alice->Bob: Good.
322322
Bob->Alice: Cool
323323
```
@@ -326,7 +326,7 @@ Bob->Alice: Cool
326326
%%{init: { "sequence": { "wrap": true, "width":300 } } }%%
327327
sequenceDiagram
328328
Alice->Bob: Hello Bob, how are you?
329-
Bob->Alice: Fine, how did you mother like the book I suggested? And did you catch the new book about alien invasion?
329+
Bob->Alice: Fine, how did your mother like the book I suggested? And did you catch the new book about alien invasion?
330330
Alice->Bob: Good.
331331
Bob->Alice: Cool
332332
```

docs/config/usage.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pnpm add mermaid
4141

4242
**Hosting mermaid on a web page:**
4343

44-
> Note:This topic explored in greater depth in the [User Guide for Beginners](../intro/getting-started.md)
44+
> Note: This topic is explored in greater depth in the [User Guide for Beginners](../intro/getting-started.md)
4545
4646
The easiest way to integrate mermaid on a web page requires two elements:
4747

@@ -100,7 +100,7 @@ Mermaid can load multiple diagrams, in the same page.
100100
101101
## Enabling Click Event and Tags in Nodes
102102

103-
A `securityLevel` configuration has to first be cleared. `securityLevel` sets the level of trust for the parsed diagrams and limits click functionality. This was introduce in version 8.2 as a security improvement, aimed at preventing malicious use.
103+
A `securityLevel` configuration has to first be cleared. `securityLevel` sets the level of trust for the parsed diagrams and limits click functionality. This was introduced in version 8.2 as a security improvement, aimed at preventing malicious use.
104104

105105
**It is the site owner's responsibility to discriminate between trustworthy and untrustworthy user-bases and we encourage the use of discretion.**
106106

@@ -115,13 +115,13 @@ Values:
115115
- **strict**: (**default**) HTML tags in the text are encoded and click functionality is disabled.
116116
- **antiscript**: HTML tags in text are allowed (only script elements are removed) and click functionality is enabled.
117117
- **loose**: HTML tags in text are allowed and click functionality is enabled.
118-
- **sandbox**: With this security level, all rendering takes place in a sandboxed iframe. This prevent any JavaScript from running in the context. This may hinder interactive functionality of the diagram, like scripts, popups in the sequence diagram, links to other tabs or targets, etc.
118+
- **sandbox**: With this security level, all rendering takes place in a sandboxed iframe. This prevents any JavaScript from running in the context. This may hinder interactive functionality of the diagram, like scripts, popups in the sequence diagram, links to other tabs or targets, etc.
119119

120120
> **Note**
121121
> This changes the default behaviour of mermaid so that after upgrade to 8.2, unless the `securityLevel` is not changed, tags in flowcharts are encoded as tags and clicking is disabled.
122122
> **sandbox** security level is still in the beta version.
123123
124-
**If you are taking responsibility for the diagram source security you can set the `securityLevel` to a value of your choosing . This allows clicks and tags are allowed.**
124+
**If you are taking responsibility for the diagram source security you can set the `securityLevel` to a value of your choosing. This allows clicks and tags are allowed.**
125125

126126
**To change `securityLevel`, you have to call `mermaid.initialize`:**
127127

docs/ecosystem/integrations.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ They also serve as proof of concept, for the variety of things that can be built
4949
- [Mermaid plugin for GitBook](https://github.com/wwformat/gitbook-plugin-mermaid-pdf)
5050
- [LiveBook](https://livebook.dev) (**Native support**)
5151
- [Atlassian Products](https://www.atlassian.com)
52+
- [Mermaid Live Editor for Confluence Cloud](https://marketplace.atlassian.com/apps/1231571/mermaid-live-editor-for-confluence?hosting=cloud&tab=overview)
5253
- [Mermaid Plugin for Confluence](https://marketplace.atlassian.com/apps/1214124/mermaid-plugin-for-confluence?hosting=server&tab=overview)
5354
- [CloudScript.io Addon](https://marketplace.atlassian.com/apps/1219878/cloudscript-io-mermaid-addon?hosting=cloud&tab=overview)
5455
- [Auto convert diagrams in Jira](https://github.com/coddingtonbear/jirafs-mermaid)

docs/intro/getting-started.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ When writing the .html file, we give two instructions inside the html code to th
103103

104104
a. The mermaid code for the diagram we want to create.
105105

106-
b. The importing of mermaid library through the `mermaid.esm.mjs` or `mermaid.esm.min.mjs` and the `mermaid.initialize()` call, which dictates the appearance of diagrams and also starts the rendering process .
106+
b. The importing of mermaid library through the `mermaid.esm.mjs` or `mermaid.esm.min.mjs` and the `mermaid.initialize()` call, which dictates the appearance of diagrams and also starts the rendering process.
107107

108108
**a. The embedded mermaid diagram definition inside a `<pre class="mermaid">`:**
109109

@@ -221,4 +221,4 @@ In this example mermaid.js is referenced in `src` as a separate JavaScript file,
221221

222222
**Comments from Knut Sveidqvist, creator of mermaid:**
223223

224-
- In early versions of mermaid, the `<script>` tag was invoked in the `<head>` part of the web page. Nowadays we can place it in the `<body>` as seen above. Older parts of the documentation frequently reflects the previous way which still works.
224+
- In early versions of mermaid, the `<script>` tag was invoked in the `<head>` part of the web page. Nowadays we can place it in the `<body>` as seen above. Older parts of the documentation frequently reflect the previous way which still works.

docs/syntax/flowchart.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1051,9 +1051,9 @@ flowchart LR
10511051
classDef foobar stroke:#00f
10521052
```
10531053

1054-
### Css classes
1054+
### CSS classes
10551055

1056-
It is also possible to predefine classes in css styles that can be applied from the graph definition as in the example
1056+
It is also possible to predefine classes in CSS styles that can be applied from the graph definition as in the example
10571057
below:
10581058

10591059
**Example style**

docs/syntax/mindmap.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ mindmap
5858

5959
The syntax for creating Mindmaps is simple and relies on indentation for setting the levels in the hierarchy.
6060

61-
In the following example you can see how there are 3 different levels. One with starting at the left of the text and another level with two rows starting at the same column, defining the node A. At the end there is one more level where the text is indented further then the previous lines defining the nodes B and C.
61+
In the following example you can see how there are 3 different levels. One with starting at the left of the text and another level with two rows starting at the same column, defining the node A. At the end there is one more level where the text is indented further than the previous lines defining the nodes B and C.
6262

6363
mindmap
6464
Root
6565
A
6666
B
6767
C
6868

69-
In summary is a simple text outline where there are one node at the root level called `Root` which has one child `A`. `A` in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap.
69+
In summary is a simple text outline where there is one node at the root level called `Root` which has one child `A`. `A` in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap.
7070

7171
```mermaid-example
7272
mindmap
@@ -228,7 +228,7 @@ _These classes need to be supplied by the site administrator._
228228

229229
## Unclear indentation
230230

231-
The actual indentation does not really matter only compared with the previous rows. If we take the previous example and disrupt it a little we can se how the calculations are performed. Let us start with placing C with a smaller indentation than `B`but larger then `A`.
231+
The actual indentation does not really matter only compared with the previous rows. If we take the previous example and disrupt it a little we can see how the calculations are performed. Let us start with placing C with a smaller indentation than `B` but larger then `A`.
232232

233233
mindmap
234234
Root

0 commit comments

Comments
 (0)