流程图的语法分为两部分
- 定义元素
- 连接元素
1、定义元素
tag=>type: content:>url
tag
:标签
type
:标签类型
六种标签类型
start
end
operation
subroutine //子程序
condition
inputoutput
content
:流程语句中放置的内容(type与content有一个空格)
url
:链接,与流程语句绑定
2、连接元素
->
连接元素时,在标签后面可以加上(right)
或者(left)
来指定连线方向
需要注意,condition类型标签似乎不可以标(left)
3、示例
```mermaid
flowchat
st=>start: start
e=>end: end
io=>inputoutput: input string(len <= 20)
cond1=>condition: input unqualified?
cond2=>condition: char is lowercase?
cond3=>condition: Is last char?
op1=>operation: change to uppercase
op2=>operation: print char
op3=>subroutine: get
st->io->cond1
cond1(no)->cond2
cond1(yes, right)->e
cond2(yes)->op1->op2
cond2(no)->op2->cond3
cond3(yes)->e
cond3(no, left)->op3(left)->cond2
\```
(最后的‘\’只是为了显示出代码段标签)