added math/katex support

This commit is contained in:
Palash Bauri 2023-04-28 10:55:59 +05:30
parent 501a1d0775
commit d07bc85e6f
No known key found for this signature in database
GPG Key ID: A46AD0C21F1F9DCF
4 changed files with 31 additions and 1 deletions

View File

@ -122,6 +122,7 @@ language = "en"
env = "development"
enablegoat = true
mermaid = true
math = true
description = "Ideas, criticism, thoughts of Palash Bauri"
author = "Palash Bauri"
mainSections = "posts"

View File

@ -55,7 +55,6 @@
"highlight",
"home-info",
"indicator",
"mastodon-container",
"mastodon-embed",
"myinfo",
"next-post",
@ -107,9 +106,12 @@
"hi--আম-পলশ-বউর",
"hi-i-am-palash-bauri",
"i-want-freedom",
"india",
"little-extra",
"masto_share",
"new-gpg-public-key-of-gmail-email-account",
"note-taking",
"pankti-programming-language",
"personal-updates",
"some-blogs-i--read-",
"দশহন--মতয",

View File

@ -11,6 +11,7 @@
</body>
{{- partial "extras/mermaid.html" . -}}
{{- partial "extras/math.html" . -}}
{{ if $.Site.Params.Enablegoat }}
<script data-goatcounter="https://aopalash.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>

View File

@ -0,0 +1,26 @@
{{ if $.Site.Params.Math }}
{{ if .Page.Params.Math }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.6/dist/katex.min.css" integrity="sha384-mXD7x5S50Ko38scHSnD4egvoExgMPbrseZorkbE49evAfv9nNcbrXJ8LLNsDgh9d" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.6/dist/katex.min.js" integrity="sha384-j/ZricySXBnNMJy9meJCtyXTKMhIJ42heyr7oAdxTDBy/CYA9hzpMo+YTNV5C+1X" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.6/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false}
],
strict : false,
trust : true,
});
});
</script>
{{ end }}
{{ end }}