diff options
author | Michael Kuhn <github@ikkoku.de> | 2022-02-22 18:45:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 18:45:10 +0300 |
commit | 591ee8d6df6b1376b58c72cc2dd15f9ec1ea9a33 (patch) | |
tree | b776f0f700184f88921d7b7ad1655a0a468c8f48 /layouts | |
parent | 4707387ffad8e632683b2f88552743676e58a67f (diff) |
feat: add KaTeX support (#211)
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/shortcodes/katex.html | 15 |
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> |