-
Notifications
You must be signed in to change notification settings - Fork 51
Page requires refresh to display mathjax formatted data. #34
Comments
+1 |
same problem: on website, mathjax need refresh to display formulas, but when mathjax use
|
Hacky workaround courtesy of @quangounet, but adding a JS loop fixes the problem:
|
@Chrisjake Awesome - works fine if added into the page - thanks! Any plans to push a PR for this? |
My "book.json" looks like this And my "fix.js" looks like this: <script> gitbook.events.bind("page.change", function() { MathJax.Hub.Queue(["Typeset", MathJax.Hub]); } </script>After adding these codes, it still can't work properly. |
Hi @walkccc I vaguely remember during my troubleshooting process adding both sequentially to the .md file with no luck, so there may also be a race condition occurring. If your gitbook is small, try manually adding the script to the bottom of each .md file? I ended up placing the script with some other js in a separate plugin that made the site header, but this may not be appropriate in your case. |
Hi @Chrisjake |
@walkccc Just FYI, you are not alone - the solution did not work for me either (I thought it did, but sadly not). I have not tried to debug this yet. |
@SamyPesse The root cause of this problem is that the CDN used for Mathjax changed. PR is here: #39 @walkccc @Chrisjake etc, the above PR isn't much use to anyone else because head revision of this plugin only work for gitbook>4. If you wanted to use this you could see the PR above for changes and/or use my update_cdn branch/fork in your gitbooks:
(although I don't guarantee it won't move). NOTE: You can't also have the script running that is recommended above, as this will render the maths twice! |
The problem is still occurring, but it seems I was able to 'fix' it by modifying require(["gitbook"], function(gitbook) {
window.addEventListener('load', function (event) {
MathJax.Hub.Config({
tex2jax: {}
});
gitbook.events.bind("page.change", function() {
MathJax.Hub.Typeset()
});
});
}); I'm not sure if this will affect the functioning of the plugin, could someone take a look at this and see if this fixes the problem? @SamyPesse It seems that currently the browser warns that Edit: I modified it to use |
@JamieChoi I think updating the mathjax CDN as above is probably a better fix #34 (comment) |
CDN of mathjax should be changed from As for gitbook, we can modify one line in BTW, if you visit |
Here's the screenshot of before a refresh.
and this is after
.
Switching between articles also trigger the same issue, upon returning to an article with mathjax formatted data, a refresh is required.
The text was updated successfully, but these errors were encountered: