mirror of
https://github.com/fruworg/themu.git
synced 2024-11-16 07:07:16 +03:00
Add mathjax and katex support (#75)
* Add mathjax and katex support * update readme
This commit is contained in:
parent
e1a3392165
commit
3fa25abce4
@ -79,6 +79,8 @@ paginate=3 # articles per page
|
||||
mode="auto" # color-mode → light,dark,toggle or auto
|
||||
useCDN=false # don't use CDNs for fonts and icons, instead serve them locally.
|
||||
subtitle = "Minimal and Clean [blog theme for Hugo](https://github.com/athul/archie)"
|
||||
mathjax = true # enable MathJax support
|
||||
katex = true # enable KaTeX support
|
||||
|
||||
# Social Tags
|
||||
|
||||
|
@ -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/katex@0.15.2/dist/katex.min.css">
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.js"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/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" }}
|
||||
|
Loading…
Reference in New Issue
Block a user