2023-07-27 14:14:55 +00:00
|
|
|
{{- $page := .page }}
|
|
|
|
{{- if and (not $page) .context }}
|
|
|
|
{{- $page = .context }}
|
2023-07-27 15:47:36 +00:00
|
|
|
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'mermaid' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180" $page.File.Path }}
|
2023-07-27 14:14:55 +00:00
|
|
|
{{- end }}
|
2022-06-22 18:32:18 +00:00
|
|
|
{{- $content := .content }}
|
|
|
|
{{- $align := .align | default "center" }}
|
2023-07-27 14:14:55 +00:00
|
|
|
{{- $zoom := $page.Site.Params.mermaidZoom | default false }}
|
|
|
|
{{- with $page.Params.mermaidZoom }}
|
2023-02-05 10:13:03 +00:00
|
|
|
{{- $zoom = . }}
|
|
|
|
{{- if eq (printf "%T" .) "string" }}
|
|
|
|
{{- $zoom = (eq . "true") }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .zoom }}
|
|
|
|
{{- $zoom = . }}
|
|
|
|
{{- if eq (printf "%T" .) "string" }}
|
|
|
|
{{- $zoom = (eq . "true") }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2023-07-27 14:14:55 +00:00
|
|
|
{{- with $page }}
|
2023-02-05 10:13:03 +00:00
|
|
|
<div class="mermaid align-{{ $align }}{{ if $zoom }} zoom{{ end }}">
|
2022-10-07 18:08:12 +00:00
|
|
|
{{- replaceRE "'" "'" ( replaceRE """ "\"" ( $content | safeHTML ) ) -}}
|
2022-06-22 18:32:18 +00:00
|
|
|
</div>
|
2023-05-18 12:01:50 +00:00
|
|
|
{{- .Store.Set "hasMermaid" true }}
|
2022-06-22 18:32:18 +00:00
|
|
|
{{- end }}
|