{{ $mermaidData := dict "theme" "default" }}
{{ $data := dict "code" .Inner "mermaid" $mermaidData }}
{{ $imgsrc := "https://mermain.ink/img/{{ $data | jsonify | base64Encode }}"}}

<figure class="mermaid">
    <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">
        <small>{{ .Get "caption" }}</small>
    </figcaption>
</figure>
