feat[math]: Added mathjax
This commit is contained in:
parent
a699dac234
commit
31519c8552
@ -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>
|
||||
|
@ -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>
|
||||
|
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>
|
@ -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%;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user