Conversation
- Add plugin/math/mathjax4.js with MathJax 4.0.0 support - Update plugin/math/plugin.js to include MathJax4 export - Add MathJax4 configuration example in examples/math.html - Add comprehensive tests in test/test-mathjax4.html - Rebuild math.js and math.esm.js with new plugin - Bump version to 5.2.2 - Support for MathJax 4.0.0 async startup procedure - Compatible macros configuration similar to MathJax3
|
@Khlick Thanks a lot for the great plugin. Finally, we can combine auto-animate with equations using Here's the code for this: <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Reveal.js + MathJax 4 + Auto-animate</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Reveal.js core CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@5.2.1/dist/reveal.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@5.2.1/dist/theme/black.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-auto-animate>
<h2>MathJax 4 Example</h2>
<p>$$\frac{\data{id=numerator}{x} }{y} \cdot y = 1$$</p>
</section>
<section data-auto-animate>
<h2>MathJax 4 Example</h2>
<p>$$\data{id=numerator}{x} = 1$$</p>
</section>
</div>
</div>
<!-- Reveal.js core JS -->
<script src="https://cdn.jsdelivr.net/npm/reveal.js@5/dist/reveal.js"></script>
<!-- MathJax 4 plugin (ES module) -->
<script type="module">
import { MathJax4 } from "https://cdn.jsdelivr.net/gh/Khlick/reveal.js/plugin/math/mathjax4.js";
Reveal.initialize({
plugins: [
MathJax4
],
mathjax4: {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']]
},
options: {
skipHtmlTags: ['script','noscript','style','textarea','pre','code']
}
}
});
</script>
</body>
</html> |
|
@hakimel Is there anything holding back merging this PR? I wonder whether it makes sense waiting for this or to start using this now by switching to the fork? |
|
This PR looks great and there are no blockers for merging. Thank you very much for adding this, @Khlick! |
|
Hi all, The MathJax fragments and the regular text fragments appear in parallel. First, we see |
|
A quick and dirty solution, if someone needs it |
|
Correct, I had also experienced this in other use cases. Reveal.js appears to need to know the fragments relatively early when generating the slides. MathJax and other dynamic content is only processed after the fragments are initialized. Creating empty fragments with respective indices is working reliably in such cases (at least to my experience). |

Summary
Adds a new MathJax4 plugin that supports MathJax 4.0.0 with proper async startup handling.
Changes
plugin/math/mathjax4.jswith MathJax 4.0.0 supportplugin/math/plugin.jsexportsexamples/math.htmlnow demonstrates MathJax4 configurationtest/test-mathjax4.html(all passing)math.jsandmath.esm.jswith new pluginKey Features
Configuration Example
Testing
test/test-mathjax4.htmlexamples/math.htmlwith HTTP serverBrowser Compatibility
Tested on modern browsers that support MathJax 4.0.0.