Support old and new syntax

This commit is contained in:
Matthieu MOREL
2020-12-10 09:35:46 +01:00
parent 62768cd617
commit b97e71e83e
8 changed files with 162 additions and 48 deletions

View File

@@ -139,7 +139,7 @@ graph LR
id1((This is the text in the circle))
```
### A node in an asymetric shape
### A node in an asymmetric shape
```
graph LR
@@ -493,7 +493,7 @@ graph LR
### Entity codes to escape characters
It is possible to escape characters using the syntax examplified here.
It is possible to escape characters using the syntax exemplified here.
```
graph LR
@@ -541,7 +541,7 @@ graph TB
end
```
You can also set an excplicit id for the subgraph.
You can also set an explicit id for the subgraph.
```
graph TB
@@ -601,6 +601,7 @@ flowchart TB
It is possible to bind a click event to a node, the click can lead to either a javascript callback or to a link which will be opened in a new browser tab. **Note**: This functionality is disabled when using `securityLevel='strict'` and enabled when using `securityLevel='loose'`.
```
click nodeId callback
click nodeId call callback()
```
@@ -620,6 +621,10 @@ Examples of tooltip usage below:
```
graph LR;
A-->B;
B-->C;
C-->D;
click A callback "Tooltip for a callback"
click B "http://www.github.com" "This is a tooltip for a link"
click A call callback() "Tooltip for a callback"
click B href "http://www.github.com" "This is a tooltip for a link"
```
@@ -629,8 +634,12 @@ The tooltip text is surrounded in double quotes. The styles of the tooltip are s
```mermaid
graph LR
A-->B;
click A call callback() "Tooltip"
click B href "http://www.github.com" "This is a link"
B-->C;
C-->D;
click A callback "Tooltip"
click B "http://www.github.com" "This is a link"
click C call callback() "Tooltip"
click D href "http://www.github.com" "This is a link"
```
> **Success** The tooltip functionality and the ability to link to urls are available from version 0.5.2.
@@ -641,16 +650,24 @@ Links are opened in the same browser tab/window by default. It is possible to ch
graph LR;
A-->B;
B-->C;
click A href "http://www.github.com" _blank
click B href "http://www.github.com" "Open this in a new tab" _blank
C-->D;
D-->E;
click A "http://www.github.com" _blank
click B "http://www.github.com" "Open this in a new tab" _blank
click C href "http://www.github.com" _blank
click D href "http://www.github.com" "Open this in a new tab" _blank
```
```mermaid
graph LR;
A-->B;
B-->C;
click A href "http://www.github.com" _blank
click B href "http://www.github.com" "Open this in a new tab" _blank
C-->D;
D-->E;
click A "http://www.github.com" _blank
click B "http://www.github.com" "Open this in a new tab" _blank
click C href "http://www.github.com" _blank
click D href "http://www.github.com" "Open this in a new tab" _blank
```
Beginners tip, a full example using interactive links in a html context:
@@ -659,8 +676,12 @@ Beginners tip, a full example using interactive links in a html context:
<div class="mermaid">
graph LR;
A-->B;
click A call callback() "Tooltip"
click B href "http://www.github.com" "This is a link"
B-->C;
C-->D;
click A callback "Tooltip"
click B "http://www.github.com" "This is a link"
click C call callback() "Tooltip"
click D href "http://www.github.com" "This is a link"
</div>
<script>
@@ -808,7 +829,7 @@ If a class is named default it will be assigned to all classes without specific
It is possible to add icons from fontawesome.
The icons are acessed via the syntax fa:#icon class name#.
The icons are accessed via the syntax fa:#icon class name#.
```
graph TD

View File

@@ -349,7 +349,7 @@ graph LR
a --> b & c--> d
```
You can then describe dependencies in a very expressive way. Like the oneliner below:
You can then describe dependencies in a very expressive way. Like the one-liner below:
```
graph TB
A & B--> C & D
@@ -594,6 +594,7 @@ flowchart TB
It is possible to bind a click event to a node, the click can lead to either a javascript callback or to a link which will be opened in a new browser tab. **Note**: This functionality is disabled when using `securityLevel='strict'` and enabled when using `securityLevel='loose'`.
```
click nodeId callback
click nodeId call callback()
```
@@ -613,6 +614,10 @@ Examples of tooltip usage below:
```
graph LR;
A-->B;
B-->C;
C-->D;
click A callback "Tooltip for a callback"
click B "http://www.github.com" "This is a tooltip for a link"
click A call callback() "Tooltip for a callback"
click B href "http://www.github.com" "This is a tooltip for a link"
```
@@ -622,8 +627,12 @@ The tooltip text is surrounded in double quotes. The styles of the tooltip are s
```mermaid
graph LR
A-->B;
click A call callback() "Tooltip"
click B href "http://www.github.com" "This is a link"
B-->C;
C-->D;
click A callback "Tooltip"
click B "http://www.github.com" "This is a link"
click C call callback() "Tooltip"
click D href "http://www.github.com" "This is a link"
```
> **Success** The tooltip functionality and the ability to link to urls are available from version 0.5.2.
@@ -634,16 +643,24 @@ Links are opened in the same browser tab/window by default. It is possible to ch
graph LR;
A-->B;
B-->C;
click A href "http://www.github.com" _blank
click B href "http://www.github.com" "Open this in a new tab" _blank
C-->D;
D-->E;
click A "http://www.github.com" _blank
click B "http://www.github.com" "Open this in a new tab" _blank
click C href "http://www.github.com" _blank
click D href "http://www.github.com" "Open this in a new tab" _blank
```
```mermaid
graph LR;
A-->B;
B-->C;
click A href "http://www.github.com" _blank
click B href "http://www.github.com" "Open this in a new tab" _blank
C-->D;
D-->E;
click A "http://www.github.com" _blank
click B "http://www.github.com" "Open this in a new tab" _blank
click C href "http://www.github.com" _blank
click D href "http://www.github.com" "Open this in a new tab" _blank
```
Beginners tip, a full example using interactive links in a html context:
@@ -652,8 +669,12 @@ Beginners tip, a full example using interactive links in a html context:
<div class="mermaid">
graph LR;
A-->B;
click A call callback() "Tooltip"
click B href "http://www.github.com" "This is a link"
B-->C;
C-->D;
click A callback "Tooltip"
click B "http://www.github.com" "This is a link"
click C call callback() "Tooltip"
click D href "http://www.github.com" "This is a link"
</div>
<script>