Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thegeeklab/hugo-geekblog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kuhn <github@ikkoku.de>2022-02-22 18:45:10 +0300
committerGitHub <noreply@github.com>2022-02-22 18:45:10 +0300
commit591ee8d6df6b1376b58c72cc2dd15f9ec1ea9a33 (patch)
treeb776f0f700184f88921d7b7ad1655a0a468c8f48 /layouts
parent4707387ffad8e632683b2f88552743676e58a67f (diff)
feat: add KaTeX support (#211)
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/katex.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/layouts/shortcodes/katex.html b/layouts/shortcodes/katex.html
new file mode 100644
index 0000000..6bb6708
--- /dev/null
+++ b/layouts/shortcodes/katex.html
@@ -0,0 +1,15 @@
+{{ if not (.Page.Scratch.Get "katex") }}
+ <!-- Include katex only first time -->
+ <link
+ rel="stylesheet"
+ href="{{ index (index .Site.Data.assets "katex.css") "src" | relURL }}"
+ />
+ <script defer src="{{ index (index .Site.Data.assets "katex.js") "src" | relURL }}"></script>
+ {{ .Page.Scratch.Set "katex" true }}
+{{ end }}
+
+<span class="gblog-katex">
+ {{ cond (in .Params "display") "\\[" "\\(" -}}
+ {{- trim .Inner "\n" -}}
+ {{- cond (in .Params "display") "\\]" "\\)" }}
+</span>