diff options
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r-- | layouts/shortcodes/katex.html | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/layouts/shortcodes/katex.html b/layouts/shortcodes/katex.html index cc98a7d..e6b7564 100644 --- a/layouts/shortcodes/katex.html +++ b/layouts/shortcodes/katex.html @@ -1,13 +1,13 @@ -{{ if not (.Page.Scratch.Get "katex") }} +{{- if not (.Page.Scratch.Get "katex") -}} <!-- Include katext only first time --> -<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}"> +<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 }} +{{- .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 {{- with .Get "class" }} class="{{ . }}"{{ end }}> + {{- cond (in .Params "display") "\\[" "\\(" -}} + {{- trim .Inner "\n" -}} + {{- cond (in .Params "display") "\\]" "\\)" -}} </span> |