Markdown流程图

Markdown流程图教程

Markdown 中,定义一个 Markdown流程图 大致分为两段,第一段是定义元素,第二段是定义元素之间的走向。

Markdown流程图语法

定义元素

tag=>type: content:>url

tag: 元素名字。

type: 是这个元素的类型。

  • start : 开始
  • end : 结束
  • operation : 操作
  • subroutine : 子程序
  • condition : 条件
  • inputoutput: 输入或产出

连接元素

c2(yes)->io->e c2(no)->op2->e

用 -> 来连接两个元素。需要注意的是 condition 类型,有 yes 和 no 两个分支。

案例

简单流程图

我们在 Typora 中,输入以下文字:

```flow st=>start: 开始 op=>operation: My Operation cond=>condition: Yes or No? e=>end st->op->cond cond(yes)->e cond(no)->op &```

Typora 展示的效果,如下图所示:

25 markdown流程图.png

复杂流程图

我们在 Typora 中,输入以下文字:

flow st=>start: Start|past:>http://www.google.com[blank] e=>end: End:>http://www.google.com op1=>operation: get_hotel_ids|past op2=>operation: get_proxy|current sub1=>subroutine: get_proxy|current op3=>operation: save_comment|current op4=>operation: set_sentiment|current op5=>operation: set_record|current cond1=>condition: ids_remain空? cond2=>condition: proxy_list空? cond3=>condition: ids_got空? cond4=>condition: 爬取成功?? cond5=>condition: ids_remain空? io1=>inputoutput: ids-remain io2=>inputoutput: proxy_list io3=>inputoutput: ids-got st->op1(right)->io1->cond1 cond1(yes)->sub1->io2->cond2 cond2(no)->op3 cond2(yes)->sub1 cond1(no)->op3->cond4 cond4(yes)->io3->cond3 cond4(no)->io1 cond3(no)->op4 cond3(yes, right)->cond5 cond5(yes)->op5 cond5(no)->cond3 op5->e

Typora 展示的效果,如下图所示:

26 markdown流程图.png

Markdown流程图总结

在 Markdown 中,定义一个 Markdown流程图大致分为两段,第一段是定义元素,第二段是定义元素之间的走向。