diff options
author | Francesco <tomaselli.fr@gmail.com> | 2025-05-18 13:23:55 +0200 |
---|---|---|
committer | Francesco <tomaselli.fr@gmail.com> | 2025-05-18 13:23:55 +0200 |
commit | 7e4e66b86fb36518397cc11492c51aeedf40bc82 (patch) | |
tree | 5989d4acd6b0578f9b4bded4639d5d4a8edf0105 | |
parent | c8e312453e6cf194c724a1890b3b41475fee2e67 (diff) |
Update katex, add rawhtml shortcode
-rw-r--r-- | layouts/partials/math.html | 11 | ||||
-rw-r--r-- | layouts/shortcodes/rawhtml.html | 1 | ||||
-rw-r--r-- | wiki/features/single-page-parameters.md | 13 |
3 files changed, 20 insertions, 5 deletions
diff --git a/layouts/partials/math.html b/layouts/partials/math.html index 62b330f..cd83fb9 100644 --- a/layouts/partials/math.html +++ b/layouts/partials/math.html @@ -1,10 +1,11 @@ -<link rel="stylesheet" - href="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css"> -<script defer - src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.js"></script> +<link rel="stylesheet" + href="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css"> + +<script defer + src="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.js"></script> <script defer - src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/contrib/auto-render.min.js" + src="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script> <script> diff --git a/layouts/shortcodes/rawhtml.html b/layouts/shortcodes/rawhtml.html new file mode 100644 index 0000000..e4edf66 --- /dev/null +++ b/layouts/shortcodes/rawhtml.html @@ -0,0 +1 @@ +{{ .Inner | safeHTML }} diff --git a/wiki/features/single-page-parameters.md b/wiki/features/single-page-parameters.md index 8ebb3c6..4f11e75 100644 --- a/wiki/features/single-page-parameters.md +++ b/wiki/features/single-page-parameters.md @@ -48,6 +48,19 @@ Enable math rendering. math: true ``` +You may encounter issues rendering complex equations. +This is due to a [known issue](https://discourse.gohugo.io/t/one-of-several-latex-equations-is-not-rendered-by-katex/47790). + +A possible workaround is to wrap your equation in `{{< rawhtml >}}` tags: + +``` +{{< rawhtml >}} +$$ +... +$$ +{{< rawhtml >}} +``` + ## Tags Create tags associated with the post and decide to show them. |