# 二选一 npm i hexo-filter-mermaid-diagrams --save yarn add hexo-filter-mermaid-diagrams
编写内容
如同一般一般代码块,先写三个反引号
后面接上mermaid
最后再加3个反引号
例如
流程图 flowchart
代码
1 2 3 4 5
graph TD; A-->B; A-->C; B-->D; C-->D;
图形
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
时序图 Sequence diagram
代码
1 2 3 4 5 6 7 8 9 10 11
sequenceDiagram participant Alice participant Bob Alice->>John: Hello John, how are you? loop Healthcheck John->>John: Fight against hypochondria end Note right of John: Rational thoughts <br/>prevail... John-->>Alice: Great! John->>Bob: How about you? Bob-->>John: Jolly good!
图形
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts prevail...
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
甘特图 Gantt diagram
代码
1 2 3 4 5 6 7 8 9
gantt dateFormat YYYY-MM-DD title Adding GANTT diagram to mermaid
section A section Completed task :done, des1, 2014-01-06,2014-01-08 Active task :active, des2, 2014-01-09, 3d Future task : des3, after des2, 5d Future task2 : des4, after des3, 5d
图形
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram to mermaid
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d