使用markdown来写文章,做笔记是非常方便的,这里记录一些高级用法,使用markdown画流程图、时序图、甘特图。

工具:Typora

UML时序图

hexo中需要配合使用hexo-filter-sequence以及hexo-filter-mermaid-diagrams插件支持渲染,具体参考:Hexo常用插件

npm install --save hexo-filter-sequence
npm install --save hexo-filter-flowchart

简单示例

源代码(反斜杠用于转义,实际不需要):

\`\`\`sequence
A->B: Hello B(请求)?
Note right of B: 对B的一些描述信息
Note left of A: 对A的一些描述
B-->A: I'm find(响应)!两杠是虚线
A->B: I'm really find.
B-B: I'm touch myself.
\`\`\`

效果:

A->B: Hello B(请求)?
Note right of B: 对B的一些描述信息
Note left of A: 对A的一些描述
B-->A: I'm find(响应)!两杠是虚线
A->B: I'm really find.
B-B: I'm touch myself.

复杂示例

源代码:

\`\`\`sequence
Title: 使用:复杂使用
A->B: Hello B?(请求)
Note right of B: 对B的描述
Note left of A: 对A的描述(提示)
B-->A: I'm Find!(响应)
B->C: How are you?
C-->>A: B touch me
A->B: are you sure?
Note over C,B: We are friend
participant C
Note right of C: 没人陪我玩
\`\`\`

效果:

Title: 使用:复杂使用
A->B: Hello B?(请求)
Note right of B: 对B的描述
Note left of A: 对A的描述(提示)
B-->A: I'm Find!(响应)
B->C: How are you?
C-->>A: B touch me
A->B: are you sure?
Note over C,B: We are friend
participant C
Note right of C: 没人陪我玩

标准流程图(flow)

源码:

\`\`\`flow
st=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st->op->cond
cond(yes)->io->e
cond(no)->sub1(right)->op
\`\`\`

效果:

st=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st->op->cond
cond(yes)->io->e
cond(no)->sub1(right)->op