mirror of
https://github.com/tomfran/typo.git
synced 2025-04-25 21:19:55 +03:00
add support for Mermaid diagrams
This commit is contained in:
parent
598717df84
commit
7a7c68d177
2 changed files with 13 additions and 1 deletions
4
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
4
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
<pre class="mermaid">
|
||||
{{- .Inner | safeHTML }}
|
||||
</pre>
|
||||
{{ .Page.Store.Set "hasMermaid" true }}
|
|
@ -70,6 +70,14 @@
|
|||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ if .Store.Get "hasMermaid" }}
|
||||
<script type="module">
|
||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
|
||||
mermaid.initialize({ startOnLoad: true });
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{/* Next prev controls */}}
|
||||
|
||||
{{ if not (.Param "hidePagination") }}
|
||||
|
@ -88,4 +96,4 @@
|
|||
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue