当然也是需要结合 markdown && vscode 使用
markdown 流程图,需要安装扩展
Markdown Preview Mermaid Support
支持流程图、饼状图、序列图、类图、状态图、甘特图、ER 图
https://mermaid-js.github.io/mermaid/
1 | 5 种流程图方向 |
5 种节点图形
| 节点 | 说明 |
|---|---|
| id[txt] | 矩形 |
| id4(txt) | 圆角矩形 |
| id3>txt] | 不对称的矩形 |
| id1{txt} | 菱形 |
| id2((txt)) | 圆形 |
9 种节点连接
| 连线 | 说明 |
|---|---|
| –> | 实现箭头 |
| — | 实线连接 |
| -.- | 虚线连接 |
| -.-> | 虚线箭头指向 |
| ==> | 加粗箭头指向 |
| – 描述 — | |
| – 描述 –> | 支持`–> |
| -. 描述 .-> | |
| == 描述 ==> |
流程图
1 | <!-- mermaid --> |
子流程图
1 | <!-- mermaid --> |
自定义样式
1 | <!-- mermaid --> |
示例
1 | <!-- mermaid --> |
更好的推荐,vscode - drawio 插件,当然drawio也有在线网页版本
js下载速度很慢啊
hexo中使用mermaid
step1
1 | npm install -S hexo-filter-mermaid-diagrams |
step2
1 | # _config.yml最底部加上 |
step3
1 | <!-- next主题默认已配置 --> |
step4
1 | 没遇到写footer.swig的不需要修改 |
step5
样式问题修改
如网页渲染的classDiagram的font-size搜索Sample stylesheet
vs code自定义样式表,设置-Markdown: Styles-项目文件夹中添加css,如source\\_data\\styles_markdown.css
如graph可以用style id1 fill:#f9f
graph LR
c1-->a2
subgraph 子内容区域
a1-->a2
end
sequenceDiagram
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!