随笔

记录,分享,然后享受生活。

0%

在hexo的next主题中开启mermaid功能

发现mermaid功能没有打开,先进入blog的根目录执行命令

1
npm install hexo-filter-mermaid-diagrams --save

然后编辑next主题文件夹下的_config.yml文件

1
vim $blog/theme/next/_config.yml

mermaidenable开关置为true

1
2
3
4
5
# Mermaid tag
mermaid:
enable: true
# Available themes: default | dark | forest | neutral
theme: forest

好了,大功告成,现在可以来画图了

1
2
3
4
graph TD;
A-->B;
A-->C;
B-->D;
graph TD;
    A-->B;
    A-->C;
    B-->D;
1
2
3
sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
sequenceDiagram
    Alice->>John: Hello John, how are you?
    John-->>Alice: Great!
1
2
3
4
5
6
pie
title Key elements in Product X
"Calcium" : 42.96
"Potassium" : 50.05
"Magnesium" : 10.01
"Iron" : 5
pie
    title Key elements in Product X
    "Calcium" : 42.96
    "Potassium" : 50.05
    "Magnesium" : 10.01
    "Iron" :  5

参考资料

使用 Typora 画图(类图、流程图、时序图)

hexo next渲染markdown mermaid流程图