forked from athul/archie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mathjax and katex support (athul#75)
* Add mathjax and katex support * update readme
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,47 @@ | |
{{ $darkstyle := resources.Get "css/dark.css" | fingerprint }} | ||
<link id="darkModeStyle" rel="stylesheet" type="text/css" href="{{ $darkstyle.Permalink }}" {{ if eq .Site.Params.mode "auto" }}media="(prefers-color-scheme: dark)"{{ end }} {{ if eq .Site.Params.mode "toggle" }}disabled{{ end }} /> | ||
{{ end }} | ||
|
||
<!-- Mathjax support --> | ||
{{ with .Site.Params.mathjax }} | ||
<script type="text/javascript" | ||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> | ||
</script> | ||
|
||
<!-- inline Mathjax --> | ||
<script type="text/x-mathjax-config"> | ||
MathJax.Hub.Config({ | ||
tex2jax: { | ||
inlineMath: [['$','$'], ['\\(','\\)']], | ||
displayMath: [['$$','$$'], ['\[','\]']], | ||
processEscapes: true, | ||
processEnvironments: true, | ||
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'], | ||
TeX: { equationNumbers: { autoNumber: "AMS" }, | ||
extensions: ["AMSmath.js", "AMSsymbols.js"] } | ||
} | ||
}); | ||
</script> | ||
{{ end }} | ||
|
||
<!-- KaTeX support --> | ||
{{ with .Site.Params.katex }} | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"> | ||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script> | ||
|
||
<!-- inline KaTeX --> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
renderMathInElement(document.body, { | ||
delimiters: [ | ||
{left: "$$", right: "$$", display: true}, | ||
{left: "$", right: "$", display: false} | ||
] | ||
}); | ||
}); | ||
</script> | ||
{{ end }} | ||
|
||
<!-- Custom CSS style get applied last --> | ||
{{- if isset .Site.Params "customcss" }} | ||
|