hugo博客增加mermaid 绘图插件

增加mermaid shortcodes 在themes/YourTheme/layouts/shortcodes/mermaid.html 增加如下内容 <script async type="application/javascript" src="https://cdn.jsdelivr.net/npm/mermaid@9.1.1/dist/mermaid.min.js"> var config = { startOnLoad:true, theme:'{{ if .Get "theme" }}{{ .Get "theme" }}{{ else }}dark{{ end }}', align:'{{ if .Get "align" }}{{ .Get "align" }}{{ else }}center{{ end }}' }; mermaid.initialize(config); </script> <div class="mermaid"> {{.Inner}} </div> 在blog中增加如下代码 Warning 注意下面的代码,你在实际写的时候,要把 /* 和 */ 删除 {{/*< mermaid align="left" theme="neutral" */>}} pie title French Words I Know "Merde" : 50 "Oui" : 35 "Alors" : 10 "Non" : 5 {{/*< /mermaid >*/}} pie title French Words I Know "...

2022-05-27 · 1 min · 王端端