Closed juanolon closed 4 months ago
Thanks, How can I verify the files you added to public/js directory? I need to make sure they match the source
Hey, i got them from the official compiled repository from mathjax: https://github.com/mathjax/MathJax/tree/master, from the folder /es5/output
I verified the files are accurate. and tried to build a project with this branch and found the embedded filesystem is not exported on build.
We'll need to explicitly Regiser every file to be exported.
Can you show me a screenshot of your page without the fonts? because on my machine it load the fonts, maybe I have them on my system already and this is why I didn't see the issue
and this are with the fixes:
I can see the wrong rendering also on the xlog website (https://xlog.emadelsaid.com/Features%20Test/)
Also, i get a lot of erros on the web-console, which are gone with the fixes
one of the errors is about the fonts not existing: https://xlog.emadelsaid.com/js/output/chtml/fonts/woff-v2/MathJax_Zero.woff (which is a 404)
The only way i found to add the script only if mathjax syntax is used is to append the script as I did before. That comes with the cost of including it multiple times. but not loading the script multiple times.
mh what about having a flag on the page, to see if mathjax is required? like
window.mathjax_loaded = false;
function require_mathjax() {
if !mathjax_loaded {
... add <script src... to DOM
}
}
and at the end of each mathjax object, we can call require_mathjax()
. This way, the script is loaded only once (similar to this: https://docs.mathjax.org/en/latest/web/configuration.html#configuring-and-loading-in-one-script). The function require_mathjax
will be present on each page, but i think that should be not much of a problem.
This changes load mathjax on the page only once. Also, it adds missing fonts, which doesn't allow to render math correctly