perf: optimize mermaid script loading
This commit is contained in:
@ -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 -}}
|
||||
|
Reference in New Issue
Block a user