add mathjax

This commit is contained in:
geekifan
2025-04-27 11:35:06 +08:00
parent 495e1c1b1e
commit 071214d1f3
2 changed files with 18 additions and 4 deletions

15
assets/js/mathjax.js Normal file
View File

@ -0,0 +1,15 @@
document.addEventListener('DOMContentLoaded', () => {
MathJax = {
tex: {
inlineMath: [
['$', '$'],
['\\(', '\\)']
],
displayMath: [
['$$', '$$'],
['\\[', '\\]']
],
tags: 'ams'
}
};
});

View File

@ -85,11 +85,10 @@
{{ if .Params.math }}
<!-- MathJax -->
{{ $mathjaxConfig := resources.Get "js/data/mathjax.js" | minify | fingerprint }}
<script async src="{{ $mathjaxConfig.RelPermalink }}"></script>
{{ $mathjaxConfig := resources.Get "js/mathjax.js" | minify | fingerprint }}
<script src="{{ $mathjaxConfig.RelPermalink }}"></script>
<script async src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
{{ $mathjax := (index site.Data.origin site.Params.cdn).mathjax.js }}
<script id="MathJax-script" async src="{{ $mathjax }}"></script>
<script id="MathJax-script" async src="{{ $data.mathjax.js }}"></script>
{{ end }}
<!-- Pageviews -->