{{/* Mermaid */}}
{{ $mermaidJsUrl := printf "https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid%s.js" (cond hugo.IsProduction ".min" "") -}}
{{ with try (resources.GetRemote $mermaidJsUrl) -}}
{{ with .Err -}}
{{ errorf "Could not retrieve Mermaid js file from %s. Reason: %s." $mermaidJsUrl . -}}
{{ else with.Value -}}
{{ with resources.Copy (printf "js/mermaid.min.js") . -}}
{{ $mermaidJs := . | fingerprint -}}
{{ end -}}
{{ end -}}
{{ end -}}