Currently only the shape above is possible and not its mirror. This might change with future releases.
菱形(A rhombus node)
1 2
graph LR id1{This is the text in the box}
1 2
graph LR id1{This is the text in the box}
六边形(A hexagon node)
1 2
graph LR id1{{This is the text in the box}}
1 2
graph LR id1{{This is the text in the box}}
平行四边形(Parallelogram)
1 2
graph TD id1[/This is the text in the box/]
1 2
graph TD id1[/This is the text in the box/]
转换的平行四边形(Parallelogram alt)
1 2
graph TD id1[\This is the text in the box\]
1 2
graph TD id1[\This is the text in the box\]
梯形(Trapezoid)
1 2
graph TD A[/Christmas\]
1 2
graph TD A[/Christmas\]
转换的梯形(Trapezoid alt)
1 2
graph TD B[\Go shopping/]
1 2
graph TD B[\Go shopping/]
链接/边(Links between nodes)
Nodes can be connected with links/edges. It is possible to have different types of links or attach a text string to a link.
A link with arrow head
1 2
graph LR A-->B
1 2
graph LR A-->B
An open link
1 2
graph LR A --- B
1 2
graph LR A --- B
Text on links
1 2
graph LR A-- This is the text! ---B
1 2
graph LR A-- This is the text! ---B
or
1 2
graph LR A---|This is the text|B
1 2
graph LR A---|This is the text|B
A link with arrow head and text
1 2
graph LR A-->|text|B
1 2
graph LR A-->|text|B
or
1 2
graph LR A-- text -->B
1 2
graph LR A-- text -->B
Dotted link
1 2
graph LR; A-.->B;
1 2
graph LR; A-.->B;
Dotted link with text
1 2
graph LR A-. text .-> B
1 2
graph LR A-. text .-> B
Thick link
1 2
graph LR A ==> B
1 2
graph LR A ==> B
Thick link with text
1 2
graph LR A == text ==> B
1 2
graph LR A == text ==> B
Chaining of links
It is possible declare many links in the same line as per below:
1 2
graph LR A -- text --> B -- text2 --> C
1 2
graph LR A -- text --> B -- text2 --> C
It is also possible to declare multiple nodes links in the same line as per below:
1 2
graph LR a --> b & c--> d
1 2
graph LR a --> b & c--> d
You can then describe dependencies in a very expressive way. Like the one-liner below:
1 2
graph TB A & B--> C & D
1 2
graph TB A & B--> C & D
If you describe the same diagram using the the basic syntax, it will take four lines. A word of warning, one could go overboard with this making the graph harder to read in markdown form. The Swedish word lagom comes to mind. It means, not too much and not too little. This goes for expressive syntaxes as well.
1 2 3 4 5
graph TB A --> C A --> D B --> C B --> D
1 2 3 4 5
graph TB A --> C A --> D B --> C B --> D
Beta: New arrow types
When using flowchart instead of graph there are new types of arrows supported as per below:
1 2 3
flowchart LR A --o B B --x C
1 2 3
flowchart LR A --o B B --x C
Beta: Multi directional arrows
When using flowchart instead of graph there is the possibility to use multidirectional arrows.
1 2 3 4
flowchart LR A o--o B B <--> C C x--x D
1 2 3 4
flowchart LR A o--o B B <--> C C x--x D
Minimum length of a link
In the following example, two extra dashes are added in the link from node B to node E, so that it spans two more ranks than regular links:
1 2 3 4 5 6
graph TD A[Start] --> B{Is it?}; B -->|Yes| C[OK]; C --> D[Rethink]; D --> B; B ---->|No| E[End];
1 2 3 4 5 6
graph TD A[Start] --> B{Is it?}; B -->|Yes| C[OK]; C --> D[Rethink]; D --> B; B ---->|No| E[End];
When the link label is written in the middle of the link, the extra dashes must be added on the right side of the link. The following example is equivalent to the previous one:
1 2 3 4 5 6
graph TD A[Start] --> B{Is it?}; B -- Yes --> C[OK]; C --> D[Rethink]; D --> B; B -- No ----> E[End];
1 2 3 4 5 6
graph TD A[Start] --> B{Is it?}; B -- Yes --> C[OK]; C --> D[Rethink]; D --> B; B -- No ----> E[End];
Special characters that break syntax
It is possible to put text within quotes in order to render more troublesome characters. As in the example below: