Add support for MathJax
This commit is contained in:
parent
769fbb55e3
commit
8aac26a42b
@ -508,6 +508,13 @@ article figcaption {
|
|||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
code.has-jax {
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
background: inherit !important;
|
||||||
|
border: none !important;
|
||||||
|
font-size: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.read-more {
|
.read-more {
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,6 @@
|
|||||||
<nav></nav>
|
<nav></nav>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if .Site.Params.mathjax }}{{ partial "mathjax_support.html" . }}{{ end }}
|
||||||
|
|
||||||
{{ partial "header-extra.html" . }}
|
{{ partial "header-extra.html" . }}
|
||||||
|
22
layouts/partials/mathjax_support.html
Normal file
22
layouts/partials/mathjax_support.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<script>
|
||||||
|
MathJax = {
|
||||||
|
tex: {
|
||||||
|
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
||||||
|
displayMath: [['$$','$$'], ['\\[', '\\]']],
|
||||||
|
processEscapes: true,
|
||||||
|
processEnvironments: true
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('load', (event) => {
|
||||||
|
document.querySelectorAll("mjx-container").forEach(function(x){
|
||||||
|
x.parentElement.classList += 'has-jax'})
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||||
|
<script type="text/javascript" id="MathJax-script" async
|
||||||
|
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
Loading…
Reference in New Issue
Block a user