Skip to content
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

Inconsistent mathjax version #72

Open
yangqian opened this issue Feb 4, 2024 · 2 comments
Open

Inconsistent mathjax version #72

yangqian opened this issue Feb 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@yangqian
Copy link

yangqian commented Feb 4, 2024

Description

rise hardcoded mathjax version to 2.7.7 in app.py while jupyterlab4 currently uses 3.2.2.
This caused some font resources to be not loaded properly. (italic font, etc. missing which makes the latex code not render correctly.)
Changing the mathjax verion to 3.2.2 seems to fix the issue. (side effect is yet to be seen).

Reproduce

markdown input latex $$x$$.

Expected behavior

x is italic

x is not italic

Context

  • Python package version:
  • Extension version:
  • jupyterlab_rise-0.42.0
  • jupyterlab 4.0.10
    jupyterlab-rise v0.42.0 enabled OK (python, jupyterlab_rise)
  • Operating System and its version:
  • ubuntu 22.04
  • Browser and its version:
    Firefox and Chrome
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Web Browser Output
Paste the output from your browser web console here.
@yangqian yangqian added the bug Something isn't working label Feb 4, 2024
@fjhickernell
Copy link

I am experiencing this problem. Please tell me how you changed the mathjax version. Thanks.

@f0k
Copy link

f0k commented Apr 16, 2024

@yangqian Thanks a lot, it works! 🎉

@fjhickernell Figure out where your jupyterlab_rise is installed. The easiest way is to run:

python3 -c 'import jupyterlab_rise; print(jupyterlab_rise.__file__)'

This will print the location of its __init__.py file. Open the app.py file in the same directory and find the following part:

        # TODO Remove CDN usage.
        mathjax_url = self.settings.get(
            "mathjax_url",
            "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js",
        )

Change the 2.7.7 to 3.2.2, save, and restart jupyter lab (if running). To figure out whether 3.2.2 is still the correct version, you can also look at schemas/@jupyterlab/mathjax-extension/package.json.orig underneath the jupyterlab_rise directory, it has a line saying "mathjax-full": "^3.2.2". (Note that modifying the installed app.py file is a hack; the canonical way would be to clone the repository, change the source code, and install from source, but then you need node.js.)

It actually looks like mathjax_url was a setting of the plugin, but it is not included in the plugin.json and can therefore not be customized. That would have avoided the need to change the source code.

The correct solution will be to either remove CDN usage (as indicated in the comment), or to introspect which mathjax version the mathjax-extension uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants