Skip to content

Commit 89c270e

Browse files
committed
feat: Update to MathJax 4
1 parent d2d8a82 commit 89c270e

File tree

432 files changed

+20176
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+20176
-83
lines changed

web/app/views/page-header.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,21 @@
139139
<?php endif ?>
140140

141141
<?php if (isset($REQUIRE_LIB['mathjax'])): ?>
142-
<!-- MathJax -->
143-
<script type="text/x-mathjax-config">
144-
MathJax.Hub.Config({
145-
showProcessingMessages: false,
146-
tex2jax: {
147-
inlineMath: [["$", "$"], ["\\\\(", "\\\\)"]],
148-
processEscapes:true
149-
},
150-
menuSettings: {
151-
zoom: "Hover"
152-
}
153-
});
142+
<!-- MathJax 4 Local Configuration -->
143+
<script>
144+
window.MathJax = {
145+
output: {
146+
font: 'mathjax-tex',
147+
fontPath: '<?= HTML::url('/js/mathjax/tex-font') ?>'
148+
},
149+
tex: {
150+
inlineMath: [['$', '$']],
151+
displayMath: [['$$', '$$']],
152+
processEscapes: true
153+
}
154+
};
154155
</script>
155-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/MathJax.js?config=TeX-AMS_HTML"></script>
156+
<script src="<?= HTML::url('/js/mathjax/dist/tex-chtml-nofont.js') ?>"></script>
156157
<?php endif ?>
157158

158159
<?php if (isset($REQUIRE_LIB['jquery.form'])): ?>

web/app/views/slide.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,32 @@
5252
<script src="<?= HTML::url('/js/reveal.js') ?>"></script>
5353
<script src="<?= HTML::url('/js/prism.js') ?>" data-manual></script>
5454

55+
<script>
56+
window.MathJax = {
57+
output: {
58+
font: 'mathjax-tex',
59+
fontPath: '<?= HTML::url('/js/mathjax/tex-font') ?>'
60+
},
61+
tex: {
62+
inlineMath: [['$', '$']],
63+
displayMath: [['$$', '$$']],
64+
processEscapes: true
65+
},
66+
// 针对 reveal.js 的特殊处理,确保在幻灯片切换后能重新渲染数学公式
67+
startup: {
68+
ready: function () {
69+
MathJax.startup.defaultReady();
70+
// reveal.js 会在 'slidechanged' 事件时触发
71+
Reveal.addEventListener('slidechanged', function(event) {
72+
MathJax.typesetPromise();
73+
});
74+
}
75+
}
76+
};
77+
</script>
78+
79+
<script src="<?= HTML::url('/js/mathjax/dist/tex-chtml-nofont.js') ?>"></script>
80+
5581
<script type="text/javascript">
5682
Reveal.initialize({
5783
controls: true,
@@ -62,17 +88,11 @@
6288

6389
transition: 'slide',
6490

65-
math: {
66-
mathjax: 'https://cdn.jsdelivr.net/npm/[email protected]/MathJax.js',
67-
config: 'TeX-AMS_HTML-full'
68-
},
69-
7091
dependencies: [
7192
{ src: '<?= HTML::url('/js/classList.js') ?>', condition: function() { return !document.body.classList; } },
7293
{ src: '<?= HTML::url('/js/reveal/plugin/prism/prism.js') ?>', async: true, condition: function() { return !!document.querySelector( 'pre code' ); } },
7394
{ src: '<?= HTML::url('/js/reveal/plugin/zoom-js/zoom.js') ?>', async: true },
7495
{ src: '<?= HTML::url('/js/reveal/plugin/notes/notes.js') ?>', async: true },
75-
{ src: '<?= HTML::url('/js/reveal/plugin/math/math.js') ?>', async: true }
7696
]
7797
});
7898
</script>

0 commit comments

Comments
 (0)