Add mathjax support
This commit is contained in:
parent
d4fc55a757
commit
0374aa92bf
@ -76,6 +76,13 @@ code {
|
||||
background: black;
|
||||
}
|
||||
|
||||
code.has-jax {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
background: inherit !important;
|
||||
border: none !important;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
font-style: italic;
|
||||
border: thin solid black;
|
||||
@ -88,4 +95,4 @@ img {
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,5 @@
|
||||
{{ $sass := resources.Get "css/main.scss" }}
|
||||
{{ $style := $sass | resources.ToCSS $options }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink | relURL }}" />
|
||||
</head>
|
||||
{{ if .Params.mathjax }} {{ partial "mathjax.html" . }} {{ end }}
|
||||
</head>
|
||||
|
21
layouts/partials/mathjax.html
Normal file
21
layouts/partials/mathjax.html
Normal file
@ -0,0 +1,21 @@
|
||||
<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 id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
Loading…
x
Reference in New Issue
Block a user