aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2019-08-22 23:59:51 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2019-08-23 00:01:14 +0200
commit185e52d2f6015671d8c7e8393ce26c6627f0553e (patch)
treed3fd109618a8e2dbc6085c584ee81a0600077e98 /layouts
parentc98b510fe050e1ec643dff97e63c9323e4dfb227 (diff)
#61, Add katex shortcode
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/katex.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/layouts/shortcodes/katex.html b/layouts/shortcodes/katex.html
new file mode 100644
index 0000000..5807c50
--- /dev/null
+++ b/layouts/shortcodes/katex.html
@@ -0,0 +1,12 @@
+{{ if not (.Page.Scratch.Get "katex") }}
+<!-- Include katext only first time -->
+<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/katex.min.css" integrity="sha384-BdGj8xC2eZkQaxoQ8nSLefg4AV4/AwB3Fj+8SUSo7pnKP6Eoy18liIKTPn9oBYNG" crossorigin="anonymous">
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/katex.min.js" integrity="sha384-JiKN5O8x9Hhs/UE5cT5AAJqieYlOZbGT3CHws/y97o3ty4R7/O5poG9F3JoiOYw1" crossorigin="anonymous"></script>
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
+{{ .Page.Scratch.Set "katex" true }}
+{{ end }}
+
+<p class="katex{{ with .Get "class" }} {{ . }}{{ end }}">
+ {{ .Inner }}
+</p>
+