2023-07-27 14:14:55 +00:00
|
|
|
{{- $page := .page }}
|
|
|
|
{{- if and (not $page) .context }}
|
|
|
|
{{- $page = .context }}
|
2023-10-27 22:36:30 +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.Filename }}
|
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-09-30 19:41:31 +00:00
|
|
|
<pre class="mermaid align-{{ $align }}{{ if $zoom }} zoom{{ end }}">
|
2022-10-07 18:08:12 +00:00
|
|
|
{{- replaceRE "'" "'" ( replaceRE """ "\"" ( $content | safeHTML ) ) -}}
|
2023-09-30 19:41:31 +00:00
|
|
|
</pre>
|
2023-05-18 12:01:50 +00:00
|
|
|
{{- .Store.Set "hasMermaid" true }}
|
2022-06-22 18:32:18 +00:00
|
|
|
{{- end }}
|