mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-28 19:43:31 +08:00
feat: added mermaid support
source: https://navendu.me/posts/adding-diagrams-to-your-hugo-blog-with-mermaid/
This commit is contained in:
parent
fddab05362
commit
5cded97fd0
@ -16,4 +16,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
<!-- Add mermaid min js file -->
|
||||||
|
{{ if (.Params.mermaid) }}
|
||||||
|
{{ partial "mermaid.html" }}
|
||||||
|
{{ end }}
|
||||||
</footer>
|
</footer>
|
||||||
|
12
layouts/partials/mermaid.html
Normal file
12
layouts/partials/mermaid.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<script
|
||||||
|
type="application/javascript"
|
||||||
|
src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"
|
||||||
|
></script>
|
||||||
|
<script>
|
||||||
|
var config = {
|
||||||
|
startOnLoad: true,
|
||||||
|
theme:'{{ if site.Params.mermaid.theme }}{{ site.Params.mermaid.theme }}{{ else }}dark{{ end }}',
|
||||||
|
align:'{{ if site.Params.mermaid.align }}{{ site.Params.mermaid.align }}{{ else }}center{{ end }}',
|
||||||
|
};
|
||||||
|
mermaid.initialize(config);
|
||||||
|
</script>
|
1
layouts/shortcodes/mermaid.html
Normal file
1
layouts/shortcodes/mermaid.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div class="mermaid">{{.Inner}}</div>
|
Loading…
Reference in New Issue
Block a user