perf: optimize mermaid script loading

This commit is contained in:
Henk Verlinde
2021-07-02 11:08:31 +02:00
parent 6e00bc86da
commit 701a4b81d1
4 changed files with 5 additions and 11 deletions

View File

@ -1,8 +1,8 @@
{{ if .Site.Params.options.mermaid -}}
{{ if .Page.Params.mermaid -}}
<div class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
{{ $data := replaceRE "(^\\s+```)" "" .Inner -}}
{{ replaceRE "(```\\s+$)" "" $data -}}
</div>
{{ else -}}
{{ errorf "Failed to process mermaid shortcode(s). Set `mermaid = true` in `./config/_default/params.toml`." }}
{{ errorf "Failed to process mermaid shortcode: %s. Set mermaid to true in page front matter." .Position }}
{{ end -}}