Skip to content

Consider updating Mathjax to version 3 or 4 #8715

Closed

Description

@cderv

RStudio IDE comes with Mathjax 2.7 bundled. This is used by rmarkdown when local mode is used for example.
Path is stored in Sys.getenv("RMARKDOWN_MATHJAX_PATH").

Mathjax 3 has been out since 2019 with some new interesting stuff. I can't find it but some users where looking to use V3 feature instead V2.7. Also, Pandoc default to this version also using https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js

For online mode, rmarkdown uses https://mathjax.rstudio.com/latest/ with config MathJax.js?config=TeX-AMS-MML_HTMLorMML for now.

There is a -full mode used by Pandoc now that could help with self-contained mode. Will look into it.

Anyway, opening this feature request to track the idea of updating Mathjax for RStudio.

Activity

  1. added this to the v1.5 milestone on Jan 13, 2021
  2. JsizzleR commented on Oct 27, 2021

    @JsizzleR

    A pro customer has requested we bundle woff fonts, currently only otf is included in /usr/lib/rstudio/resources/mathjax-27/fonts/HTML-CSS/TeX/. Can this change be made when upgrading to MathJax3?
    (woff2 as well if included in MathJax3: mathjax/MathJax#1990)

    Customer request no. 67732

  3. scarnecchia commented on Jun 29, 2022

    @scarnecchia

    I see this is slated for 2024, but I was wondering if it would be feasible to bump it up the priority list, as there is a known XSS vulnerability in versions of MathJax earlier than 2.7.4.

    Alternatively, should I open an issue for bumping the version up to a 2.7.5?

  4. kevinushey commented on Jun 29, 2022

    @kevinushey
    Collaborator

    My understanding is that MathJax 3 has a number of API changes that may require some extra work to adapt to. It should be easier for us to take the latest version of MathJax 2.7, though.

  5. modified the milestones: Backlog-3, Later on Oct 5, 2023
  6. kevinushey commented on May 22, 2024

    @kevinushey
    Collaborator

    We'll plan to update to the latest version of Mathjax 2.7; updating to Mathjax 3 will take more time / effort than we have available for the upcoming release. #11535

  7. cderv commented on Jul 11, 2024

    @cderv
    CollaboratorAuthor

    Update on this : mathjax.rstudio.com/latest has been updated to 2.7.9

  8. ronblum commented on Jul 18, 2024

    @ronblum
    Contributor

    We're at 2.7.9, but let's leave this open in "Later" for a possible future in which we use MathJax 3. Or should we close this altogether?

  9. cderv commented on Jul 18, 2024

    @cderv
    CollaboratorAuthor

    We could leave this open, but @kevinushey comments still apply here

    updating to Mathjax 3 will take more time / effort than we have available for the upcoming release

    I think there are some more changes between 2 and 3 that needs testing, and Mathjax 4 is already in beta, so 2 to 4 will probably be the next move. But I don't know the impact. Maybe we'll stop providing our own bundle, and use CDN one. we'll see;

    Thanks @ronblum !

  10. changed the title [-]Update Mathjax to version 3[/-] [+]Consider updating Mathjax to version 3 or 4[/+] on Jul 18, 2024
  11. ronblum commented on Jul 18, 2024

    @ronblum
    Contributor

    I reworded the subject line to reflect this. 🙂

  12. GregDMeyer commented on Aug 14, 2024

    @GregDMeyer

    Just wanted to note that I use the TeX input extensions introduced in MathJax 3 (see here) in my writing, and it would be really great to see them included in the otherwise-great visual editor! Currently most of my equations don't render correctly because of this. Sounds like it might be a fair amount of work to upgrade though, so I understand if it can't be done super soon.

  13. lachlansimpson commented on Mar 20, 2025

    @lachlansimpson

    Updating MathJax from 2.7.9 has come up in internal support ticket #116287 re CVE-2023-39663

    Mathjax up to v2.7.9 was discovered to contain two Regular expression Denial of Service (ReDoS) vulnerabilities in MathJax.js via the components pattern and markdownPattern. NOTE: the vendor disputes this because the regular expressions are not applied to user input; thus, there is no risk.

    From the MathJax repo issue:

    These regular expressions would be a concern if they were applied to user-supplied strings, but they are only applied to MathJax-supplied strings, and those strings don't include the troublesome situations like the ones you are suggesting. Users can't call these functions directly (and if they could, you would have much bigger problems than this).

  14. added theissue type on Jul 10, 2026
  15. self-assigned this
    on Jul 13, 2026
  16. kevinushey commented on Jul 20, 2026

    @kevinushey
    Collaborator

    The next release of RStudio (coming in August) will use Mathjax 4.

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions