Merge pull request #162 from cychen2021/master

Add support for MathJax
This commit is contained in:
Dmitry Kolosov 2022-07-25 20:04:40 +03:00 committed by GitHub
commit e3b162689c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -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;
} }

View File

@ -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" . }}

View 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>