Update mermaid shortcode

This commit is contained in:
ItsDrike 2023-12-10 01:09:25 +01:00
parent 4c212e8f64
commit 8d6976467a
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -1,8 +1,12 @@
{{ $mermaidData := dict "theme" "default" }} {{ $mermaidData := dict "theme" "default" }}
{{ $data := dict "code" .Inner "mermaid" $mermaidData }} {{ $data := dict "code" .Inner "mermaid" $mermaidData }}
{{ $imgsrc := "https://mermain.ink/img/{{ $data | jsonify | base64Encode }}"}}
<figure class="mermaid"> <figure class="mermaid">
<img src="https://mermaid.ink/img/{{ $data | jsonify | base64Encode }}" referrerpolicy="no-referrer"> <img src="{{ $imgsrc }}" referrerpolicy="no-referrer" style="object-fit: scale-down;"
{{ if .Get "width" }}width='{{ .Get "width" }}' {{ end }}
{{ if .Get "height" }}height='{{ .Get "height" }}' {{ end }}
>
<figcaption class="text-center"> <figcaption class="text-center">
<small>{{ .Get "caption" }}</small> <small>{{ .Get "caption" }}</small>
</figcaption> </figcaption>