Skip to content

Conversation

@Ocin4ever
Copy link

@Ocin4ever Ocin4ever commented Dec 14, 2025

Hi,
I recently started using Anki for my Physics studies and noticed that the \oiint symbol isn’t supported in MathJax. It turns out this feature was only introduced in MathJax version 4.

Fixes: #4277

anki_screenshot

MathJax recently received an important update with v4.
It adds some new intresting features (see: https://docs.mathjax.org/en/latest/upgrading/whats-new-4.0.html)
@user1823
Copy link
Contributor

You can add Fixes #4277 to the original post so that the issue is auto-closed when this is merged. Thanks!

@Ocin4ever
Copy link
Author

done :)

@abdnh
Copy link
Collaborator

abdnh commented Dec 15, 2025

Some expressions fail to load for some reason while editing existing notes.
image

Here are some errors:

JS error /_anki/js/editor.js:33094 Refused to load the script 'https://cdn.jsdelivr.net/npm/@mathjax/mathjax-newcm-font/svg/dynamic/math.js' because it violates the following Content Security Policy directive: "script-src http://127.0.0.1:40000/_anki/ http://127.0.0.1:40000/_addons/". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

JS warning /_anki/js/editor.js:39523 Error: Can't load "https://cdn.jsdelivr.net/npm/@mathjax/mathjax-newcm-font/svg/dynamic/math.js"
JS error /_anki/js/editor.js:33712 Refused to create a worker from 'blob:http://127.0.0.1:40000/237cef21-aec6-48ab-9331-1411ac5d6105' because it violates the following Content Security Policy directive: "script-src http://127.0.0.1:40000/_anki/ http://127.0.0.1:40000/_addons/". Note that 
'worker-src' was not explicitly set, so 'script-src' is used as a fallback.

JS error /_anki/js/editor.js:33712 Uncaught (in promise) SecurityError: Failed to construct 'Worker': Access to the script at 'blob:http://127.0.0.1:40000/237cef21-aec6-48ab-9331-1411ac5d6105' is denied by the document's Content Security Policy.

I can reproduce it with simple expressions such as \sqrt{2}.

@GithubAnon0000
Copy link
Contributor

I seem to be able to use mathjax in both, the add notes dialog and if I edit existing cards using this PR. I cannot reproduce even with \sqrt{2}.

I do also get two errors, though:

editor.js:33712 Refused to create a worker from 'blob:http://127.0.0.1:40000/2c2821d5-7a30-4b91-9dca-fd798f3c5a24' because it violates the following Content Security Policy directive: "script-src http://127.0.0.1:40000/_anki/ http://127.0.0.1:40000/_addons/". Note that 'worker-src' was not explicitly set, so 'script-src' is used as a fallback.
(anonymous)	@	editor.js:33712


Uncaught (in promise) DOMException: Failed to construct 'Worker': Access to the script at 'blob:http://127.0.0.1:40000/2c2821d5-7a30-4b91-9dca-fd798f3c5a24' is denied by the document's Content Security Policy.
    at Ks.<anonymous> (http://127.0.0.1:40000/_anki/js/editor.js:33712:84)
    at Generator.next (<anonymous>)
    at http://127.0.0.1:40000/_anki/js/editor.js:33545:48
    at new Promise (<anonymous>)
    at Xs (http://127.0.0.1:40000/_anki/js/editor.js:33524:20)
    at Ks.createWorker (http://127.0.0.1:40000/_anki/js/editor.js:33708:22)
    at cg.<anonymous> (http://127.0.0.1:40000/_anki/js/editor.js:48690:50)
    at Generator.next (<anonymous>)
    at http://127.0.0.1:40000/_anki/js/editor.js:48668:48
    at new Promise (<anonymous>)

Those errors are not present in the current main branch.

Regarding CDN

I don't get cdn errors. But I'm wondering if their presence means that anki has to fetch stuff online for certain mathjax components to work. If true, I think that should be changed. E.g. input/tex/extensions/mhchem.js and input/tex/extensions/bbm.js have a cdn link in their source code (you can find them in out/node_modules/mathjax).

Though current main also has cdn in their mathjax source, e.g. in out/node_modules/mathjax/es5/ui/menu.js, so maybe it either works offline by default or it just never was support completely offline.

But since abdnh seems to get cdn errors for fonts and cannot see anything rendered, I believe that the cdn is infact being used and the error abdo got is the reason that nothing shows up.

Others

Interesstingly even with this PR, if I go to the preview of a card containing mathjax, then right-click on the mathjax and then "About MathJax" it still shows me v3.2.2 instead of version 4. I am on 310a710, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate MathJax 4.0

4 participants