Skip to main content

Markdown 画图

https://blog.csdn.net/whatday/article/details/88655461

Markdown 是标记语言编辑器,画图时不能从上往下,同时又从左往右。

使用方法

mermaid 结尾添加

graph LR;
A-->B
B-->C
C-->D
D-->A
graph LR;
A-->B
B-->C
C-->D
D-->A
graph TB;
A
B[bname]
C(cname)
D((dname))
E>ename]
F{fname}
graph TB;
A
B[bname]
C(cname)
D((dname))
E>ename]
F{fname}
graph TB
A1-->B1
A2---B2
A3--text---B3
A4--text-->B4
A5-.-B5
A6-.->B6
A7-.text.-B7
A8-.text.->B8
A9===B9
A10==>B10
A11==text===B11
A12==text==>B12
graph TB
A1-->B1
A2---B2
A3--text---B3
A4--text-->B4
A5-.-B5
A6-.->B6
A7-.text.-B7
A8-.text.->B8
A9===B9
A10==>B10
A11==text===B11
A12==text==>B12
graph LR
start("input x") --> handler("x > 0?")
handler --yes--> yes("output x")
handler --no--> start
yes --> exit("exit")
graph LR
start("input x") --> handler("x > 0?")
handler --yes--> yes("output x")
handler --no--> start
yes --> exit("exit")

subgraph(子图)

graph LR
subgraph g1
a1-->b1
end
subgraph g2
a2-->b2
end
subgraph g3
a3-->b3
end
a3-->a2
graph LR
subgraph g1
a1-->b1
end
subgraph g2
a2-->b2
end
subgraph g3
a3-->b3
end
a3-->a2

时序图

sequenceDiagram
  Alice->>Bob: Hello Bob, how are you?
  alt is sick
    Bob->>Alice:not so good :(
  else is well
    Bob->>Alice:good
  end
  opt Extra response
    Bob->>Alice:Thanks for asking
  end
sequenceDiagram
  Alice->>Bob: Hello Bob, how are you?
  alt is sick
    Bob->>Alice:not so good :(
  else is well
    Bob->>Alice:good
  end
  opt Extra response
    Bob->>Alice:Thanks for asking
  end
sequenceDiagram
Note right of A: 倒霉, 碰到B了
A->B: Hello B, how are you ?
note left of B: 倒霉,碰到A了
B-->A: Fine, thx, and you?
note over A,B: 快点溜,太麻烦了
A->>B: I'm fine too.
note left of B: 快点打发了A
B-->>A: Great!
note right of A: 溜之大吉
A-xB: Wait a moment
loop Look B every minute
  A->>B: look B, go?
  B->>A: let me go?
 end
 B--xA: I'm off, byte  
note right of A: 太好了, 他走了
sequenceDiagram
Note right of A: 倒霉, 碰到B了
A->B: Hello B, how are you ?
note left of B: 倒霉,碰到A了
B-->A: Fine, thx, and you?
note over A,B: 快点溜,太麻烦了
A->>B: I'm fine too.
note left of B: 快点打发了A
B-->>A: Great!
note right of A: 溜之大吉
A-xB: Wait a moment
loop Look B every minute
  A->>B: look B, go?
  B->>A: let me go?
 end
 B--xA: I'm off, byte  
note right of A: 太好了, 他走了
sequenceDiagram
# 通过设定参与者(participant)的顺序控制展示顺序
participant B
participant A
Note right of A: 倒霉, 碰到B了
A->B: Hello B, how are you ?
note left of B: 倒霉,碰到A了
B-->A: Fine, thx, and you?
note over A,B:快点溜,太麻烦了。。。
A->>B: I'm fine too.
note left of B: 快点打发了A
B-->>A: Great!
note right of A: 溜之大吉
A-xB: Wait a moment
loop Look B every minute
  A->>B: look B, go?
  B->>A: let me go?
 end
 B--xA: I'm off, byte  
note right of A: 太好了, 他走了
sequenceDiagram
# 通过设定参与者(participant)的顺序控制展示顺序
participant B
participant A
Note right of A: 倒霉, 碰到B了
A->B: Hello B, how are you ?
note left of B: 倒霉,碰到A了
B-->A: Fine, thx, and you?
note over A,B:快点溜,太麻烦了。。。
A->>B: I'm fine too.
note left of B: 快点打发了A
B-->>A: Great!
note right of A: 溜之大吉
A-xB: Wait a moment
loop Look B every minute
  A->>B: look B, go?
  B->>A: let me go?
 end
 B--xA: I'm off, byte  
note right of A: 太好了, 他走了
sequenceDiagram
# 通过设定参与者(participants)的顺序控制展示模块顺序
participant Alice
 participant Bob
 participant John
 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: good!
sequenceDiagram
# 通过设定参与者(participants)的顺序控制展示模块顺序
participant Alice
 participant Bob
 participant John
 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: good!

Gantt diagram(甘特图)

title标题
dataFormat日期格式
section模块
Completed已经完成
Active当前正在进行
Future后续待处理
crit关键阶段
日期缺失默认从上一项完成后
gantt
dateFormat YYYY-MM-DD
section S1
T1: 2014-01-01, 9d
section S2
T2: 2014-01-11, 9d
section S3
T3: 2014-01-02, 9d
gantt
dateFormat YYYY-MM-DD
section S1
T1: 2014-01-01, 9d
section S2
T2: 2014-01-11, 9d
section S3
T3: 2014-01-02, 9d
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality 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

section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to mermaid :1d

section Documentation
Describe gantt syntax :active, a1, after des1, 3d
Add gantt diagram to demo page :after a1 , 20h
Add another diagram to demo page :doc1, after a1 , 48h

section Last section
Describe gantt syntax :after doc1, 3d
Add gantt diagram to demo page : 20h
Add another diagram to demo page : 48h
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality 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

section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to mermaid :1d

section Documentation
Describe gantt syntax :active, a1, after des1, 3d
Add gantt diagram to demo page :after a1 , 20h
Add another diagram to demo page :doc1, after a1 , 48h

section Last section
Describe gantt syntax :after doc1, 3d
Add gantt diagram to demo page : 20h
Add another diagram to demo page : 48h