Mermaid
使用教程:从入门到精通 - 知乎 mermaid 画图示例 - gantt 1
2
3
4
5
6
7
8
9gantt
title 工作计划
dateFormat YYYY-MM-DD
section Section
A task :a1, 2020-01-01, 30d
Another task :after a1 , 20d
section Another
Task in sec :2020-01-12 , 12d
another task : 24d1
2
3
4
5
6
7
8
9
10
11gantt
title A Gantt Diagram
dateFormat YYYY-MM-DD
section Section
A task :a1, 2014-01-01, 30d
Another task :after a1 , 20d
section Another
Task in sec :2014-01-12 , 12d
another task : 24d1
2
3
4
5
6graph LR
A[开始] --> B(处理)
B --> C{决策}
C -->|是| D[结束]
C -->|否| B1
2
3
4sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Hi Alice, I'm doing well, thank you!
类图 classDiagram
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
class Duck{
+String beakColor
+swim()
+quack()
}
class Fish{
-int sizeInFeet
-canEat()
}
class Zebra{
+bool is_wild
+run()
}实体关系图 erDiagram
1
2
3
4
5erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : usespie
1
2
3
4
5
6
7pie
title Example Pie Chart
"Apples" : 45.0
"Oranges" : 25.0
"Bananas" : 15.0
"Grapes" : 10.0
"Pears" : 5.0
[!info]- 更多的 Mermaid 支持多种类型的图表,包括: 1. 流程图 (Flowchart) : 展示过程、决策和操作流程 2. 序列图 (Sequence Diagram) : 展示对象之间的交互顺序 3. 甘特图(Gantt Chart) : 展示项目计划和进度 4. 词云图 (Class Diagram) : 展示类的结构和关系 5. 饼图 (Pie Chart) : 展示数据占比。 6. 捷径图 (Shortcut) : 简单展示快捷方式 7. 状态图 (State Diagram) : 展示对象状态的转换 8. 用户旅程图 (Journey) : 展示用户如何与应用程序交互
1 | classDiagram |