支持时序图
技术文档中常会用到时序图,hugo 默认不支持时序图,需要安装 mermaid.js.
参考: hugo-mermaid
我使用的hugo主题是: hugo-theme-stack
使用方法
在路径layouts/_default/_markup/下新建一个文件render-codeblock-mermaid.html,内容为:
|
|
然后在layouts/partials/article/content.html最后面添加如下代码:
|
|
这样就可以了,hugo server -D 运行看看效果
示例
|
|
效果
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 <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!