feat[math]: Added mathjax

This commit is contained in:
Judah Sotomayor 2023-10-16 12:14:59 -04:00
parent a699dac234
commit 31519c8552
4 changed files with 35 additions and 0 deletions

View File

@ -18,6 +18,10 @@
{{ block "footer" . }}
<!-- More shared code, perhaps a footer but that can be overridden if need be in -->
<script src="/js/dark.js" defer="" ></script>
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
{{ end }}
</body>
</html>

View File

@ -7,4 +7,5 @@
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/fonts.css">
<!-- End stylesheets -->
{{ if .Params.mathjax }}{{ partial "mathjax_support.html" . }}{{ end }}
</head>

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>

View File

@ -55,3 +55,11 @@ border: solid;
border-weight: 2pt;
padding: 4pt;
}
code.has-jax {
-webkit-font-smoothing: antialiased;
background: inherit !important;
border: none !important;
font-size: 100%;
}