aboutsummaryrefslogtreecommitdiff
path: root/layouts/shortcodes/katex.html
blob: cc98a7de563d69c1b19c59a9cddee935f15fc4e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
{{ if not (.Page.Scratch.Get "katex") }}
<!-- Include katext only first time -->
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}">
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script>
{{ .Page.Scratch.Set "katex" true }}
{{ end }}

<span class="katex{{ with .Get "class" }} {{ . }}{{ end }}">
  {{ if in .Params "display" }}\[{{ else }}\({{ end -}}
  {{ $.Inner }}
  {{- if in .Params "display" }}\]{{ else }}\){{ end }}
</span>