2019-07-12 20:40:54 +02:00
# Flowcharts - Basic Syntax
2021-02-21 10:18:46 +01:00
**Edit this Page** [![N|Solid ](img/GitHub-Mark-32px.png )](https://github.com/mermaid-js/mermaid/blob/develop/docs/flowchart.md)
2020-11-15 16:19:13 +01:00
2021-05-18 22:34:24 +02:00
All Flowcharts are composed of **nodes** , the geometric shapes and **edges** , the arrows or lines. The mermaid code defines the way that these **nodes** and **edges** are made and interact.
2021-05-01 20:39:50 +02:00
2022-02-17 04:18:45 +01:00
It can also accommodate different arrow types, multi directional arrows, and linking to and from subgraphs.
2021-05-01 20:39:50 +02:00
2021-05-01 20:42:42 +02:00
> **Important note**: Do not type the word "end" as a Flowchart node. Capitalize all or any one the letters to keep the flowchart from breaking, i.e, "End" or "END". Or you can apply this [workaround](https://github.com/mermaid-js/mermaid/issues/1444#issuecomment-639528897).**
2022-04-26 18:27:38 +02:00
2021-05-01 20:39:50 +02:00
### A node (default)
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2021-05-01 20:39:50 +02:00
id
```
> **Note** The id is what is displayed in the box.
### A node with text
It is also possible to set text in the box that differs from the id. If this is done several times, it is the last text
found for the node that will be used. Also if you define edges for the node later on, you can omit text definitions. The
one previously defined will be used when rendering the box.
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2021-05-01 20:39:50 +02:00
id1[This is the text in the box]
```
2019-07-12 20:40:54 +02:00
## Graph
2020-06-22 00:19:45 +02:00
This statement declares the direction of the Flowchart.
2019-07-12 20:40:54 +02:00
2021-08-26 18:55:47 +02:00
This declares the flowchart is oriented from top to bottom (`TD` or `TB` ).
2019-07-12 20:40:54 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2019-07-12 20:40:54 +02:00
Start --> Stop
```
2021-08-26 18:55:47 +02:00
This declares the flowchart is oriented from left to right (`LR`).
2019-09-30 20:59:10 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-09-30 20:59:10 +02:00
Start --> Stop
```
2019-07-12 20:40:54 +02:00
2020-06-22 00:19:45 +02:00
## Flowchart Orientation
2019-07-12 20:40:54 +02:00
2020-06-22 00:19:45 +02:00
Possible FlowChart orientations are:
2019-07-12 20:40:54 +02:00
2020-06-22 00:19:45 +02:00
* TB - top to bottom
* TD - top-down/ same as top to bottom
* BT - bottom to top
* RL - right to left
* LR - left to right
2019-07-12 20:40:54 +02:00
2021-05-01 20:39:50 +02:00
## Node shapes
2019-07-12 20:40:54 +02:00
### A node with round edges
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
id1(This is the text in the box)
```
2019-12-08 16:51:47 +01:00
### A stadium-shaped node
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-12-08 16:51:47 +01:00
id1([This is the text in the box])
```
2020-04-10 00:14:41 +02:00
### A node in a subroutine shape
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2020-04-10 00:14:41 +02:00
id1[[This is the text in the box]]
```
2019-12-31 16:30:03 +01:00
### A node in a cylindrical shape
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-12-31 16:30:03 +01:00
id1[(Database)]
```
2019-07-12 20:40:54 +02:00
### A node in the form of a circle
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
id1((This is the text in the circle))
```
2020-10-14 14:41:15 +02:00
### A node in an asymmetric shape
2019-07-12 20:40:54 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
id1>This is the text in the box]
```
Currently only the shape above is possible and not its mirror. *This might change with future releases.*
### A node (rhombus)
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
id1{This is the text in the box}
```
2019-10-03 04:38:41 +02:00
### A hexagon node
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-10-03 04:38:41 +02:00
id1{{This is the text in the box}}
```
2019-11-17 17:37:30 +01:00
### Parallelogram
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2019-11-17 17:37:30 +01:00
id1[/This is the text in the box/]
```
### Parallelogram alt
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2019-11-17 17:37:30 +01:00
id1[\This is the text in the box\]
```
2019-08-08 08:42:03 +02:00
### Trapezoid
2019-07-21 11:23:23 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2019-07-21 11:23:23 +02:00
A[/Christmas\]
```
2019-08-08 08:42:03 +02:00
### Trapezoid alt
2019-07-21 11:23:23 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2019-07-21 11:23:23 +02:00
B[\Go shopping/]
```
2022-02-16 23:16:58 +01:00
### Double circle
```mermaid-example
flowchart TD
2022-02-17 17:22:38 +01:00
id1(((This is the text in the circle)))
2022-02-16 23:16:58 +01:00
```
2019-07-12 20:40:54 +02:00
## 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
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A-->B
```
### An open link
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A --- B
```
### Text on links
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2020-05-06 18:51:12 +02:00
A-- This is the text! ---B
2019-07-16 21:13:40 +02:00
```
2019-07-12 20:40:54 +02:00
or
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A---|This is the text|B
```
### A link with arrow head and text
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A-->|text|B
```
or
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A-- text -->B
```
### Dotted link
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR;
2019-07-12 20:40:54 +02:00
A-.->B;
```
### Dotted link with text
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A-. text .-> B
```
### Thick link
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A ==> B
```
### Thick link with text
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A == text ==> B
```
2019-10-08 22:56:50 +02:00
### Chaining of links
It is possible declare many links in the same line as per below:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-10-08 22:56:50 +02:00
A -- text --> B -- text2 --> C
```
2020-01-22 18:52:16 +01:00
It is also possible to declare multiple nodes links in the same line as per below:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2020-01-22 18:52:16 +01:00
a --> b & c--> d
```
2020-12-10 09:35:46 +01:00
You can then describe dependencies in a very expressive way. Like the one-liner below:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TB
2020-01-22 18:52:16 +01:00
A & B--> C & D
```
If you describe the same diagram using the the basic syntax, it will take four lines. A
2021-08-26 18:55:47 +02:00
word of warning, one could go overboard with this making the flowchart harder to read in
2020-11-17 20:40:16 +01:00
markdown form. The Swedish word `lagom` comes to mind. It means, not too much and not too little.
2020-01-22 18:52:16 +01:00
This goes for expressive syntaxes as well.
2021-11-11 03:04:40 +01:00
```mmd
2021-08-26 18:55:47 +02:00
flowchart TB
2020-01-22 18:52:16 +01:00
A --> C
A --> D
B --> C
B --> D
```
2021-08-26 18:55:47 +02:00
### New arrow types
2020-05-03 21:52:44 +02:00
2021-08-26 18:55:47 +02:00
There are new types of arrows supported as per below:
2020-05-03 21:52:44 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2020-05-03 21:52:44 +02:00
flowchart LR
A --o B
B --x C
```
2021-08-26 18:55:47 +02:00
### Multi directional arrows
2020-05-03 21:52:44 +02:00
2021-08-26 18:55:47 +02:00
There is the possibility to use multidirectional arrows.
2020-05-03 21:52:44 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2020-05-03 21:52:44 +02:00
flowchart LR
A o--o B
B < -- > C
C x--x D
```
2019-10-08 22:56:50 +02:00
2020-08-07 01:20:44 +02:00
### Minimum length of a link
Each node in the flowchart is ultimately assigned to a rank in the rendered
graph, i.e. to a vertical or horizontal level (depending on the flowchart
orientation), based on the nodes to which it is linked. By default, links
can span any number of ranks, but you can ask for any link to be longer
than the others by adding extra dashes in the link definition.
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:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2022-02-17 17:45:13 +01:00
A[Start] --> B{Is it?}
B -->|Yes| C[OK]
C --> D[Rethink]
D --> B
B ---->|No| E[End]
2020-08-07 01:20:44 +02:00
```
> **Note** Links may still be made longer than the requested number of ranks
> by the rendering engine to accommodate other requests.
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:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2022-02-17 17:45:13 +01:00
A[Start] --> B{Is it?}
B -- Yes --> C[OK]
C --> D[Rethink]
D --> B
B -- No ----> E[End]
2020-08-07 01:20:44 +02:00
```
For dotted or thick links, the characters to add are equals signs or dots,
as summed up in the following table:
| Length | 1 | 2 | 3 |
|-------------------|:------:|:-------:|:--------:|
| Normal | `---` | `----` | `-----` |
| Normal with arrow | `-->` | `--->` | `---->` |
| Thick | `===` | `====` | `=====` |
| Thick with arrow | `==>` | `===>` | `====>` |
| Dotted | `-.-` | `-..-` | `-...-` |
| Dotted with arrow | `-.->` | `-..->` | `-...->` |
2019-07-12 20:40:54 +02:00
## 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:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
id1["This is the (text) in the box"]
```
### Entity codes to escape characters
2020-10-14 14:41:15 +02:00
It is possible to escape characters using the syntax exemplified here.
2019-07-12 20:40:54 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A["A double quote:#quot;"] -->B["A dec char:#9829;"]
```
2021-02-09 11:01:27 +01:00
Numbers given are base 10, so `#` can be encoded as `#35;` . It is also supported to use HTML character names.
2019-07-12 20:40:54 +02:00
## Subgraphs
```
subgraph title
graph definition
end
```
An example below:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TB
2019-07-12 20:40:54 +02:00
c1-->a2
subgraph one
a1-->a2
end
subgraph two
b1-->b2
end
subgraph three
c1-->c2
end
```
2020-10-14 14:41:15 +02:00
You can also set an explicit id for the subgraph.
2020-03-11 19:52:57 +01:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TB
2020-03-11 19:52:57 +01:00
c1-->a2
subgraph ide1 [one]
a1-->a2
end
```
2019-07-12 20:40:54 +02:00
2022-02-17 17:45:13 +01:00
## flowcharts
2020-05-03 13:31:09 +02:00
2022-02-17 17:45:13 +01:00
With the graphtype flowchart it is also possible to set edges to and from subgraphs as in the flowchart below.
2020-05-03 13:31:09 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2020-05-03 13:31:09 +02:00
flowchart TB
c1-->a2
subgraph one
a1-->a2
end
subgraph two
b1-->b2
end
subgraph three
c1-->c2
end
one --> two
three --> two
two --> c2
```
2021-05-18 22:34:24 +02:00
## Direction in subgraphs
2021-06-21 05:25:56 +02:00
With the graphtype flowcharts you can use the direction statement to set the direction which the subgraph will render like in this example.
2021-05-18 22:34:24 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-05-18 22:34:24 +02:00
flowchart LR
subgraph TOP
direction TB
subgraph B1
direction RL
i1 -->f1
end
subgraph B2
direction BT
i2 -->f2
end
end
A --> TOP --> B
B1 --> B2
```
2019-07-12 20:40:54 +02:00
## Interaction
2019-08-28 20:59:28 +02:00
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'` .
2019-07-12 20:40:54 +02:00
```
2020-12-10 09:35:46 +01:00
click nodeId callback
2020-12-06 21:33:53 +01:00
click nodeId call callback()
2019-07-12 20:40:54 +02:00
```
* nodeId is the id of the node
* callback is the name of a javascript function defined on the page displaying the graph, the function will be called with the nodeId as parameter.
Examples of tooltip usage below:
2020-09-07 08:02:09 +02:00
```html
2019-07-12 20:40:54 +02:00
< script >
2022-05-11 03:08:32 +02:00
var callback = function () {
alert('A callback was triggered');
};
2020-03-29 06:55:14 +02:00
< / script >
2019-07-12 20:40:54 +02:00
```
2021-11-02 04:18:18 +01:00
The tooltip text is surrounded in double quotes. The styles of the tooltip are set by the class `.mermaidTooltip` .
```mermaid-example
2022-02-17 17:45:13 +01:00
flowchart LR
A-->B
B-->C
C-->D
2020-12-10 09:35:46 +01:00
click A callback "Tooltip for a callback"
2022-05-31 23:18:45 +02:00
click B "https://www.github.com" "This is a tooltip for a link"
2020-12-06 21:33:53 +01:00
click A call callback() "Tooltip for a callback"
2022-05-31 23:18:45 +02:00
click B href "https://www.github.com" "This is a tooltip for a link"
2019-07-12 20:40:54 +02:00
```
> **Success** The tooltip functionality and the ability to link to urls are available from version 0.5.2.
2020-03-29 06:55:14 +02:00
?> Due to limitations with how Docsify handles JavaScript callback functions, an alternate working demo for the above code can be viewed at [this jsfiddle ](https://jsfiddle.net/s37cjoau/3/ ).
2020-07-28 10:49:54 +02:00
Links are opened in the same browser tab/window by default. It is possible to change this by adding a link target to the click definition (`_self`, `_blank` , `_parent` and `_top` are supported):
2021-11-02 04:18:18 +01:00
```mermaid-example
2022-02-17 17:45:13 +01:00
flowchart LR
A-->B
B-->C
C-->D
D-->E
2022-05-31 23:18:45 +02:00
click A "https://www.github.com" _blank
click B "https://www.github.com" "Open this in a new tab" _blank
click C href "https://www.github.com" _blank
click D href "https://www.github.com" "Open this in a new tab" _blank
2020-07-28 10:49:54 +02:00
```
2022-08-19 18:55:50 +02:00
Beginner's tip—a full example using interactive links in a html context:
2020-09-07 08:02:09 +02:00
```html
2019-08-28 20:59:28 +02:00
< body >
< div class = "mermaid" >
2022-02-17 17:45:13 +01:00
flowchart LR
A-->B
B-->C
C-->D
2020-12-10 09:35:46 +01:00
click A callback "Tooltip"
2022-05-31 23:18:45 +02:00
click B "https://www.github.com" "This is a link"
2020-12-10 09:35:46 +01:00
click C call callback() "Tooltip"
2022-05-31 23:18:45 +02:00
click D href "https://www.github.com" "This is a link"
2019-08-28 20:59:28 +02:00
< / div >
2019-10-08 22:56:50 +02:00
2019-08-28 20:59:28 +02:00
< script >
2022-05-11 03:08:32 +02:00
var callback = function () {
alert('A callback was triggered');
};
var config = {
startOnLoad: true,
flowchart: { useMaxWidth: true, htmlLabels: true, curve: 'cardinal' },
securityLevel:'loose'
};
2019-08-28 20:59:28 +02:00
mermaid.initialize(config);
< / script >
< / body >
```
2019-07-12 20:40:54 +02:00
2019-11-27 00:34:52 +01:00
### Comments
Comments can be entered within a flow diagram, which will be ignored by the parser. Comments need to be on their own line, and must be prefaced with `%%` (double percent signs). Any text after the start of the comment to the next newline will be treated as a comment, including any flow syntax
2021-11-11 03:04:40 +01:00
```mmd
2021-08-26 18:55:47 +02:00
flowchart LR
2019-11-27 00:34:52 +01:00
%% this is a comment A -- text --> B{node}
A -- text --> B -- text2 --> C
```
2019-07-12 20:40:54 +02:00
## Styling and classes
### Styling links
2022-08-19 18:55:50 +02:00
It is possible to style links. For instance, you might want to style a link that is going backwards in the flow. As links
2019-07-12 20:40:54 +02:00
have no ids in the same way as nodes, some other way of deciding what style the links should be attached to is required.
2022-06-11 10:24:45 +02:00
Instead of ids, the order number of when the link was defined in the graph is used, or use default to apply to all links.
In the example below the style defined in the linkStyle statement will belong to the fourth link in the graph:
2019-07-12 20:40:54 +02:00
2021-11-02 04:18:18 +01:00
```
2020-02-02 22:59:59 +01:00
linkStyle 3 stroke:#ff3,stroke-width:4px,color:red;
2019-07-12 20:40:54 +02:00
```
2022-08-25 21:01:55 +02:00
### Styling line curves
It is possible to style the type of curve used for lines between items, if the default method does not meet your needs.
Available curve styles include `basis` , `bump` , `linear` , `monotoneX` , `monotoneY` , `natural` , `step` , `stepAfter` ,
and `stepBefore` .
In this example, a left-to-right graph uses the `stepBefore` curve style:
```
%%{ init: { 'flowchart': { 'curve': 'stepBefore' } } }%%
graph LR
```
For a full list of available curves, including an explanation of custom curves, refer to
the [Shapes ](https://github.com/d3/d3-shape/blob/main/README.md#curves ) documentation in the
[d3-shape ](https://github.com/d3/d3-shape/ ) project.
2019-07-12 20:40:54 +02:00
### Styling a node
It is possible to apply specific styles such as a thicker border or a different background color to a node.
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
id1(Start)-->id2(Stop)
style id1 fill:#f9f,stroke:#333,stroke-width:4px
2020-07-30 01:18:58 +02:00
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
2019-07-12 20:40:54 +02:00
```
#### Classes
2021-04-25 01:27:05 +02:00
More convenient than defining the style every time is to define a class of styles and attach this class to the nodes that
2019-07-12 20:40:54 +02:00
should have a different look.
a class definition looks like the example below:
```
classDef className fill:#f9f,stroke:#333,stroke-width:4px;
```
Attachment of a class to a node is done as per below:
```
class nodeId1 className;
```
It is also possible to attach a class to a list of nodes in one statement:
```
class nodeId1,nodeId2 className;
```
2020-01-22 18:52:16 +01:00
A shorter form of adding a class is to attach the classname to the node using the `:::` operator as per below:
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2020-01-22 18:52:16 +01:00
A:::someclass --> B
classDef someclass fill:#f96;
```
2019-07-12 20:40:54 +02:00
### Css classes
It is also possible to predefine classes in css styles that can be applied from the graph definition as in the example
below:
**Example style**
```html
< style >
.cssClass > rect{
fill:#FF0000;
stroke:#FFFF00;
stroke-width:4px;
}
< / style >
```
**Example definition**
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR;
2022-02-17 17:45:13 +01:00
A-->B[AAA< span > BBB< / span > ]
B-->D
class A cssClass
2019-07-16 21:13:40 +02:00
```
2019-07-12 20:40:54 +02:00
### Default class
If a class is named default it will be assigned to all classes without specific class definitions.
```
classDef default fill:#f9f,stroke:#333,stroke-width:4px;
```
## Basic support for fontawesome
It is possible to add icons from fontawesome.
2020-10-14 14:41:15 +02:00
The icons are accessed via the syntax fa:#icon class name#.
2019-07-12 20:40:54 +02:00
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart TD
2022-07-31 19:51:15 +02:00
B["fab:fa-twitter for peace"]
2019-07-12 20:40:54 +02:00
B-->C[fa:fa-ban forbidden]
B-->D(fa:fa-spinner);
2022-02-17 17:45:13 +01:00
B-->E(A fa:fa-camera-retro perhaps?)
2019-07-12 20:40:54 +02:00
```
2022-07-31 20:08:27 +02:00
?> Mermaid is now only compatible with Font Awesome versions 4 and 5. Check that you are using the correct version of Font Awesome.
2019-07-12 20:40:54 +02:00
## Graph declarations with spaces between vertices and link and without semicolon
* In graph declarations, the statements also can now end without a semicolon. After release 0.2.16, ending a graph statement with semicolon is just optional. So the below graph declaration is also valid along with the old declarations of the graph.
2021-03-26 17:18:03 +01:00
* A single space is allowed between vertices and the link. However there should not be any space between a vertex and its text and a link and its text. The old syntax of graph declaration will also work and hence this new feature is optional and is introduced to improve readability.
2019-07-12 20:40:54 +02:00
Below is the new declaration of the graph edges which is also valid along with the old declaration of the graph edges.
2021-11-02 04:18:18 +01:00
```mermaid-example
2021-08-26 18:55:47 +02:00
flowchart LR
2019-07-12 20:40:54 +02:00
A[Hard edge] -->|Link text| B(Round edge)
B --> C{Decision}
C -->|One| D[Result one]
C -->|Two| E[Result two]
```
## Configuration...
Is it possible to adjust the width of the rendered flowchart.
2022-06-26 11:12:35 +02:00
This is done by defining **mermaid.flowchartConfig** or by the CLI to use a JSON file with the configuration. How to use the CLI is described in the mermaidCLI page.
2019-07-12 20:40:54 +02:00
mermaid.flowchartConfig can be set to a JSON string with config parameters or the corresponding object.
```javascript
mermaid.flowchartConfig = {
width: 100%
}
```