{{- /* Mermaid rendering partial for code fences extended syntax and shortcode usage. - Skips rendering when MarkupScope is home. - Supports wrapped view with tabs/actions and plain diagram mode. - Supports per-diagram filename for code/download actions. @param {Object} [.Options] - Render options from shortcode or code fence attributes @param {Boolean} [.Options.wrapper] - Whether to enable wrapped diagram UI @param {String} [.Options.filename] - Filename used by diagram/code actions @param {String} [.Inner] - Inline Mermaid source content @param {Object} [.Page] - Current page context */ -}} {{- if ne hugo.Context.MarkupScope "home" -}} {{- $code := strings.TrimSpace .Inner -}} {{- $mermaidConfig := dict "Page" .Page "Key" "mermaid" | partial "function/param.html" -}} {{- $wrapped := .Options.wrapper | default $mermaidConfig.wrapper -}} {{- if $wrapped -}} {{- $labelDiagram := T "tabs.diagram" -}} {{- $labelCode := T "tabs.code" -}} {{- $labelZoomIn := T "diagram.zoomIn" -}} {{- $labelZoomOut := T "diagram.zoomOut" -}} {{- $labelReset := T "diagram.reset" -}} {{- $labelDownload := T "diagram.download" -}} {{- $filename := .Options.filename | default "mermaid.mmd" -}} {{- $codeAttrs := printf `{copyable=true, fullscreen=true, filename="%s", class="diagram-code"}` $filename -}} {{- $codeFence := printf "```text %s\n%s\n```" $codeAttrs $code -}}
{{ $labelDiagram }} {{ $labelCode }}
{{ $code | safeHTML }}
{{ $code | safeHTML }}
{{ $code | safeHTML }}
{{- $codeFence | .Page.RenderString (dict "display" "block") -}}
{{- .Page.Store.Set "hasPanzoom" true -}} {{- else -}}
{{ $code | safeHTML }}
{{ $code | safeHTML }}
{{ $code | safeHTML }}
{{- dict "Label" "Copy Mermaid code" | partial "plugin/diagram-copy-btn.html" -}}
{{- end -}} {{- .Page.Store.Set "hasMermaid" true -}} {{- end -}}