aboutsummaryrefslogtreecommitdiffstats
path: root/code/frontpage/layouts/shortcodes/mermaid.html
blob: aeecad535278b3387b031d50ae9597735d73a1ab (plain) (blame)
1
2
3
4
5
6
7
8
{{ 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 to true in page front matter." .Position }}
{{ end -}}