summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramzrk22020-07-25 18:20:25 +0800
committeramzrk22020-07-25 18:20:25 +0800
commit62ae83b7513c2c6c8bd857b7ed5f9f2f47512b43 (patch)
tree5473f24efe652cd963101943c9b82b55e8d97bd4
parentdef669cf636eaacc7c567192bf1bfb8a362c03e9 (diff)
downloadhugo-theme-fuji-62ae83b7513c2c6c8bd857b7ed5f9f2f47512b43.tar.gz
hugo-theme-fuji-62ae83b7513c2c6c8bd857b7ed5f9f2f47512b43.tar.bz2
hugo-theme-fuji-62ae83b7513c2c6c8bd857b7ed5f9f2f47512b43.zip
Update LaTeX shortcode
-rw-r--r--README.md35
-rw-r--r--layouts/shortcodes/math.html5
2 files changed, 40 insertions, 0 deletions
diff --git a/README.md b/README.md
index ccb029c..0a2468d 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@ Now supported i18n langs: en, zh-hans, zh-hant, ja, nl, pt-pt. Check the i18n fo
- [🎨 Favicon](#-favicon)
- [❌ License, toc und comments](#-license-toc-und-comments)
- [🎵 APlayer](#-aplayer)
+ - [📐 Render LaTeX with KaTex](#-image-zoom-and-lazyload-settings)
- [📷 Image zoom and lazyload settings](#-image-zoom-and-lazyload-settings)
- [⚓ Markdown render hook](#-markdown-render-hook)
- [📨 Comments area](#-comments-area)
@@ -115,6 +116,40 @@ In-post APlayer supported, you can set these variables in post's front matter:
playerCover = "..."
```
+### 📐 Render LaTeX with KaTex
+
+You can write LaTeX directly in markdown with escape characters:
+
+```txt
+$$
+\begin{matrix}
+ a & b \\\\ c & d
+\end{matrix}
+$$
+```
+
+Or use the short code, display style:
+
+```txt
+{{< math >}}
+\begin{matrix}
+ a & b \\
+ c & d
+\end{matrix}
+{{</ math >}}
+```
+
+Inline style:
+
+```txt
+{{< math "inline" >}}
+\begin{matrix}
+ a & b \\
+ c & d
+\end{matrix}
+{{</ math >}}
+```
+
### 📷 Image zoom and lazyload settings
Zoomable, not lazyloaded:
diff --git a/layouts/shortcodes/math.html b/layouts/shortcodes/math.html
new file mode 100644
index 0000000..3fcdaa7
--- /dev/null
+++ b/layouts/shortcodes/math.html
@@ -0,0 +1,5 @@
+{{ if len .Params | eq 1 }}
+\( {{- trim .Inner "\n" -}} \)
+{{ else }}
+$$ {{- trim .Inner "\n" -}} $$
+{{ end }} \ No newline at end of file