2021-07-01 07:05:26 +00:00
|
|
|
---
|
|
|
|
title: Mermaid
|
|
|
|
---
|
|
|
|
|
2020-05-31 16:17:32 +00:00
|
|
|
[Mermaid](https://mermaidjs.github.io/) is library for generating SVG charts and diagrams from text.
|
2020-01-12 14:33:02 +00:00
|
|
|
|
2023-10-27 19:38:23 +00:00
|
|
|
## Usage
|
2020-01-12 14:33:02 +00:00
|
|
|
|
2020-09-10 20:23:24 +00:00
|
|
|
<!-- prettier-ignore -->
|
2020-01-12 14:33:02 +00:00
|
|
|
```tpl
|
2022-10-14 10:21:12 +00:00
|
|
|
{{</* mermaid class="text-center" */>}}
|
2020-01-12 14:33:02 +00:00
|
|
|
sequenceDiagram
|
|
|
|
Alice->>Bob: Hello Bob, how are you?
|
|
|
|
alt is sick
|
|
|
|
Bob->>Alice: Not so good :(
|
|
|
|
else is well
|
|
|
|
Bob->>Alice: Feeling fresh like a daisy
|
|
|
|
end
|
|
|
|
opt Extra response
|
|
|
|
Bob->>Alice: Thanks for asking
|
|
|
|
end
|
|
|
|
{{</* /mermaid */>}}
|
|
|
|
```
|
|
|
|
|
2023-10-27 19:38:23 +00:00
|
|
|
### Attributes
|
|
|
|
|
|
|
|
<!-- prettier-ignore-start -->
|
|
|
|
<!-- spellchecker-disable -->
|
|
|
|
{{< propertylist name=shortcode-mermaid sort=name order=asc >}}
|
|
|
|
<!-- spellchecker-enable -->
|
|
|
|
<!-- prettier-ignore-end -->
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
2020-06-07 15:42:03 +00:00
|
|
|
<!-- spellchecker-disable -->
|
2020-09-10 20:23:24 +00:00
|
|
|
<!-- prettier-ignore -->
|
2020-03-03 10:14:34 +00:00
|
|
|
{{< mermaid class="text-center" >}}
|
2020-01-12 14:33:02 +00:00
|
|
|
sequenceDiagram
|
|
|
|
Alice->>Bob: Hello Bob, how are you?
|
|
|
|
alt is sick
|
|
|
|
Bob->>Alice: Not so good :(
|
|
|
|
else is well
|
|
|
|
Bob->>Alice: Feeling fresh like a daisy
|
|
|
|
end
|
|
|
|
opt Extra response
|
|
|
|
Bob->>Alice: Thanks for asking
|
|
|
|
end
|
|
|
|
{{< /mermaid >}}
|
2020-09-10 20:23:24 +00:00
|
|
|
|
2020-06-07 15:42:03 +00:00
|
|
|
<!-- spellchecker-enable -->
|
2020-01-12 14:33:02 +00:00
|
|
|
|
2022-08-29 19:52:44 +00:00
|
|
|
As an alternative to shortcodes, code blocks can be used for markdown as well.
|
|
|
|
|
|
|
|
{{< columns >}}
|
|
|
|
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
````tpl
|
|
|
|
```mermaid
|
|
|
|
flowchart LR
|
|
|
|
A[Hard] -->|Text| B(Round)
|
|
|
|
B --> C{Decision}
|
|
|
|
C -->|One| D[Result 1]
|
|
|
|
C -->|Two| E[Result 2]
|
|
|
|
```
|
|
|
|
````
|
|
|
|
|
|
|
|
<--->
|
|
|
|
|
|
|
|
<!-- spellchecker-disable -->
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
```mermaid
|
|
|
|
flowchart LR
|
|
|
|
A[Hard] -->|Text| B(Round)
|
|
|
|
B --> C{Decision}
|
|
|
|
C -->|One| D[Result 1]
|
|
|
|
C -->|Two| E[Result 2]
|
|
|
|
```
|
|
|
|
|
|
|
|
<!-- spellchecker-enable -->
|
|
|
|
|
|
|
|
{{< /columns >}}
|