-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Upgrade to Mathjax 3 (ankitects/help-wanted#19) #809
Conversation
Thanks for looking into this! I like that the files are being generated at build, as it will make it easier to keep up with point releases. When you say you're getting a localStorage error, do you mean this is just dumping something to the console, or do you mean it's preventing MathJax from actually working? The plan is to eventually migrate away from data: in setHtml()/stdHtml() in favour of separate HTML page(s), as the current approach places an upper limit on the number of decks that can be shown for example. But it will likely be a while before that move can be made. Here are some examples of configuration: |
The Concerning configuration: All the existing configurations would break. I also tried the following, with which I could switch the inline MathJax delimiters from MathJax.config.tex.displayMath = ['\\*', '*/']
MathJax.startup.getComponents() So it seems it is sufficiently configurable, however it breaks existing setups. |
Sorry, the Bazel merge has meant some work will be required to integrate this with master. If you could look into the other files, I can help out with the Makefile equivalent if you need it - probably needs a genrule() Might be worth excluding the 1.3MB mathmaps_ie.js which we presumably don't need. |
4794ab2
to
5646707
Compare
Also it doesn't seem to be that easy to write a "copy files" target, as you have to specify all the out files in I specified the filegroup here, however.
They both continue to show up in my untracked files. |
Yeah, this is a bit tricky unfortunately, but should be possible in a .bzl file - either by manually listing the desired files in a list and then constructing the outs list and copy commands, or by doing something like this: https://stackoverflow.com/a/57983629 ...which I have not tested, but the issue with Bazel 2.0 may be fixable by calling to_list() on the depset. If you find yourself spending too much time on it, please let me know and I'll take a stab - unless @agentydragon wants to give it a try |
Re the untracked files, those files are no longer used, and you can delete them. |
Could you please see if this fixes this issue: https://forums.ankiweb.net/t/bold-math-does-not-work-in-mathjax-on-the-linux-desktop-client/5073 ? |
@dae I spent my whole Saturday trying to get it run, but to no avail. This is code I had at the very end:
My idea was to create a file ".mathjax" in the ts directory, which is created when the files are copied (kinda how it was done before switching to Bazel), and leave the MathJax files out of the outputs, which is acceptable according to the Bazel docs. Some difficulties are:
|
Thanks for giving it a go, I'll take a stab at this when I have a chance. |
Managed to figure it out, and this is now in master - let's see how it goes in the next beta. Thank you for your work on this! |
This PR updates MathJax to v3.1.2.
After some small changes, yes. Whereas MathJax 2 implemented its own synchronisation methods, MathJax 3 completely relies on Promises, which seems more stable to me.
I don't really know how the user would have done that before with MathJax 2. Could you elaborate?
As far as I see, everything works fine. The MathJax API changed quite a bit, so add-ons which rely on the old MathJax 2 API (maybe for synchronization with MathJax output) will surely break.
I also moved the creation of the MathJax files in the
mathjax
directory to the build process as a new target ints/Makefile
.The problem mentioned in https://github.com/ankitects/help-wanted/issues/19 still persists though.
According to GitHub posts I found, MathJax 2 used cookies to save settings whereas MathJax 3 uses
localStorage
. However neither cookies nor localStorage are supported in data URLs. Did you have to deal with this issue, when you first implemented MathJax support in Anki?