aboutsummaryrefslogtreecommitdiff
path: root/layouts/shortcodes
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2020-04-11 20:05:43 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2020-04-11 20:05:43 +0200
commite4e43bd9b12a3e37f0d3c2760ea7f867ba8273a7 (patch)
tree60543b71a718f34e4d27a54c8028c6888db39f69 /layouts/shortcodes
parentd61558462fb5f16d171ba327bc6315b82e49054b (diff)
Refactor KaTeX shortcode, remove whitespaces and fix font size
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/katex.html16
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>