-
-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support MathJax 3.0 #692
Comments
Thanks for the heads up. I'll have to figure out what is different |
@lgeiger So, there appears to be nothing I need to do to support MathJax 3.0. It is all on you, the user's, side. So looking through the docs there are a couple of things to note:
I'm not sure why some of the things they were using before got abandoned, but luckily they posted some info on how to work around things. So, to the docs!
This got things working again for me:
|
So, yeah, docs maybe could mention this. I imagine there will be slow trickle of people coming over to 3.0. It is not complete yet, but there are some benefits potentially. People will have to suffer through figuring how to get it configured like they like it as there is quite a difference in setup. |
Sorry, the earlier config was my personal settings converted. I believe this is the bare minimum required: <script>
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process',
renderActions: {
find: [10, function (doc) {
for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
const display = !!node.type.match(/; *mode=display/);
const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
const text = document.createTextNode('');
node.parentNode.replaceChild(text, node);
math.start = {node: text, delim: '', n: 0};
math.end = {node: text, delim: '', n: 0};
doc.math.push(math);
}
}, '']
}
}
};
</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" id="MathJax-script"></script> |
Okay, last update. Apparently the previews that are present (plain text versions) also don't get removed if they are enabled, so in that case, this would work: <script>
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process',
renderActions: {
find: [10, function (doc) {
for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
const display = !!node.type.match(/; *mode=display/);
const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
const text = document.createTextNode('');
const sibling = node.previousElementSibling;
node.parentNode.replaceChild(text, node);
math.start = {node: text, delim: '', n: 0};
math.end = {node: text, delim: '', n: 0};
doc.math.push(math);
if (sibling && sibling.matches('.MathJax_Preview')) {
sibling.parentNode.removeChild(sibling);
}
}
}, '']
}
}
};
</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" id="MathJax-script"></script> |
Feel free to check out the linked pull for more examples. |
Thanks for the documentation. Indeed the problem was on the user side. MathJax 2 accepted Thanks for your help! |
I'm not sure what you are specifically referring to here. Are you using the generic form of Arithmatex output (that doesn't wrap content in script tags)? Normally, you can just use Maybe you are just getting lucky? In my tests, you need to include the JavaScript I showed above for And specify the math normally. No extra escaping. |
Yeah, I just tested again. No extra escaping is needed. Arithmatex takes care of everything IF you have your JavaScript config configured correctly. |
MathJax 3.0 was released last month with many improvements.
When I load it from
https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js
to render math, the inline math is ignored. It would be great ifpymdown-extensions
would support MathJax 3.0 since it is quite a bit faster in rendering the Math.The text was updated successfully, but these errors were encountered: