Skip to content

Update hosted version of MathJax to 2.7.9 #14803

Closed

Description

@ronblum

Update the hosted MathJax at https://mathjax.rstudio.com/latest/MathJax.js to the latest 2.7 version, 2.7.9, to complement the change we made in RStudio: #11535

Activity

  1. added
    new
    and removed
    new
    on Jun 7, 2024
  2. added this to the Cranberry Hibiscus milestone on Jun 7, 2024
  3. gtritchie commented on Jul 8, 2024

    @gtritchie
    Member

    We're still discussing whether this change needs to happen for Cranberry Hibiscus or can wait.

  4. jspiewak commented on Jul 8, 2024

    @jspiewak
    Member

    2.7.9 is uploaded.
    Is it possible to test before I make it the default?

  5. gtritchie commented on Jul 8, 2024

    @gtritchie
    Member

    I'm looking into what tests, if any, we can run before going live with this.

  6. self-assigned this
    on Jul 8, 2024
  7. gtritchie commented on Jul 8, 2024

    @gtritchie
    Member

    Given the minor version bump (and no obvious way to test this) the RMarkdown team said it should be fine to go live.

  8. jspiewak commented on Jul 8, 2024

    @jspiewak
    Member
    (default) ➜  ~ curl -I https://mathjax.rstudio.com/latest
    HTTP/2 302
    content-length: 0
    location: https://mathjax.rstudio.com/2.7.9
    date: Mon, 08 Jul 2024 19:59:40 GMT
    server: AmazonS3
    x-cache: Miss from cloudfront
    via: 1.1 685fd458a839bc725280d7e9380648c6.cloudfront.net (CloudFront)
    x-amz-cf-pop: BOS50-C2
    x-amz-cf-id: tVPWaEuI1z6lly8f1MfMyohX5sR-_8mqry_14ra4_p13nHfYxMvL6g==
    
  9. Mosk915 commented on Jul 8, 2024

    @Mosk915

    I started having issues with the pagedown package a little while ago. I traced it to this file which is referencing MathJax sources that seem to no longer exist.

    https://github.com/rstudio/pagedown/blob/6763538deb2cd78de05631715ea57085a85b8bd6/inst/resources/css/jss-fonts.css#L24

  10. gtritchie commented on Jul 9, 2024

    @gtritchie
    Member

    Yes, appears we may have broken things. Will get this reverted back to the previous state ASAP.

  11. cderv commented on Jul 9, 2024

    @cderv
    Collaborator

    It seems the fonts are not available at the same place as before

    This is the url used in pagedown - note no latest used.

    > curl -I http://mathjax.rstudio.com/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff
    HTTP/1.1 404 Not Found
    Connection: keep-alive
    x-amz-error-code: NoSuchKey
    x-amz-error-message: The specified key does not exist.
    x-amz-error-detail-Key: fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff
    Date: Tue, 09 Jul 2024 11:59:46 GMT
    Server: AmazonS3
    X-Cache: Error from cloudfront
    Via: 1.1 a746325e2c0a55fa6c56e06293f59b40.cloudfront.net (CloudFront)
    X-Amz-Cf-Pop: VIE50-P2
    X-Amz-Cf-Id: nKplbmiBeafqgDtJHRQsRr91HExPBo5hU73RxoGzRl0PYYIN58odXQ==

    It seems url that works is latest but which points still to 2.7.2

    > curl -I http://mathjax.rstudio.com/latest/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff
    HTTP/1.1 302 Moved Temporarily
    Content-Length: 0
    Connection: keep-alive
    Date: Mon, 08 Jul 2024 16:46:36 GMT
    Location: https://mathjax.rstudio.com/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff
    Server: AmazonS3
    X-Cache: Hit from cloudfront
    Via: 1.1 08f9b351f61685659ad70b790734f9b0.cloudfront.net (CloudFront)
    X-Amz-Cf-Pop: VIE50-P2
    X-Amz-Cf-Id: qfNq0A--rm08owOFqWUSgh5FQceRLg2gcGLs9FT0p9-o6AVNXLQ7GA==
    Age: 69316

    So are we missing fonts in the update ?

    > curl -I http://mathjax.rstudio.com/2.7.9/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff 
    HTTP/1.1 404 Not Found
    Connection: keep-alive
    x-amz-error-code: NoSuchKey
    x-amz-error-message: The specified key does not exist.
    x-amz-error-detail-Key: 2.7.9/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff
    Date: Tue, 09 Jul 2024 12:04:46 GMT
    Server: AmazonS3
    X-Cache: Error from cloudfront
    Via: 1.1 63b0889adbeadc5106837d12ac6fbc18.cloudfront.net (CloudFront)
    X-Amz-Cf-Pop: VIE50-P2
    X-Amz-Cf-Id: gVaMSmVs5zZgrutllnR_x8zjvraAWfo4PImNw4MDrnhklqj8kChgvA==

    Note that for mathjax itself it works ok and available at latest/

    So it seems to be only a redirect problem with missing content compare what was exposed before.
    https://github.com/mathjax/MathJax/tree/legacy-v2/fonts/HTML-CSS

  12. 17 remaining items

  13. cderv commented on Jul 9, 2024

    @cderv
    Collaborator

    @Mosk915 no thank you. I found out the problem is in Mathjax itself, and unrelated to the line you share in your post. The JS is directly loading some fonts, and not in a way that works currently in our hosted mode.

    We'll find a solution before updating again.

  14. cderv commented on Jul 9, 2024

    @cderv
    Collaborator

    @jspiewak Do you know where do we retrieved the Mathjax version 2.7.9 for the update ? Did you use same as the one locally added ?

    I believe the change is related to the fact we don't use the packed version. If you compare our 2.7.2 and our 2.7.9 version we can see differences. One of them is

        MathJax.isPacked = true;

    This is commented in 2.7.9 version, but not in 2.7.2 and in the cdn example above.

    and this is used in Mathjax for the font directory

              fontDir: e + (b.isPacked ? "" : "/..") + "/fonts",

    This is why the font url used is probably not right as /.. applies.

    So we probably need to use a packed version, and minified

  15. gtritchie commented on Jul 9, 2024

    @gtritchie
    Member

    @kevinushey prepared the bundled MathJax update not too long ago. Details on what he did here: #14738

    Update: though I see that his steps include deleting the fonts, so presumably we don't want to do that.

  16. jspiewak commented on Jul 9, 2024

    @jspiewak
    Member

    @jspiewak Do you know where do we retrieved the Mathjax version 2.7.9 for the update ? Did you use same as the one locally added ?

    I believe the change is related to the fact we don't use the packed version. If you compare our 2.7.2 and our 2.7.9 version we can see differences. One of them is

        MathJax.isPacked = true;

    This is commented in 2.7.9 version, but not in 2.7.2 and in the cdn example above.

    and this is used in Mathjax for the font directory

              fontDir: e + (b.isPacked ? "" : "/..") + "/fonts",

    This is why the font url used is probably not right as /.. applies.

    So we probably need to use a packed version, and minified

    Yes, I do. I don't understand "same as the one locally added".
    I am looking to switch to the packed version. Stand by.

  17. jspiewak commented on Jul 9, 2024

    @jspiewak
    Member

    k, in theory packed version uploaded and invalidated /2.7.9/*, if someone could explicitly test 2.7.9 again?

  18. cderv commented on Jul 9, 2024

    @cderv
    Collaborator

    "same as the one locally added".

    This relates to original issue #11535 closed by @ronblum when they updated the version of Mathjax bundled into the IDE directly.

    if someone could explicitly test 2.7.9 again?

    ---
    title: "Test"
    output: 
      html_document:
        math_method:
          engine: mathjax
          url: https://mathjax.rstudio.com/2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML
    ---
    
    $$
    x + y
    $$

    This works fine now !

    I'll test chrome_print too.

  19. cderv commented on Jul 9, 2024

    @cderv
    Collaborator

    chrome_print is working. So all good - this is the right version, and seems to be the exact same that we bundle in RStudio IDE
    (like the one I have on windows at rstudio-daily\2024.07.0+293-daily\resources\app\resources\mathjax-27\MathJax.js

    So it seems all good now.

  20. jspiewak commented on Jul 9, 2024

    @jspiewak
    Member

    Great, I will make 2.7.9 the latest again, and get all the steps taken (and the test snippet) captured in the hopes of avoiding relearning all of this again in the future.

  21. jspiewak commented on Jul 9, 2024

    @jspiewak
    Member

    2.7.9 is latest again and invalidation has run:

    (default) ➜  ~ curl -IL https://mathjax.rstudio.com/latest/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff
    HTTP/2 302
    content-length: 0
    location: https://mathjax.rstudio.com/2.7.9/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff
    date: Tue, 09 Jul 2024 17:29:47 GMT
    server: AmazonS3
    x-cache: Miss from cloudfront
    via: 1.1 cd9c85933a60bbac347299c34015e9ba.cloudfront.net (CloudFront)
    x-amz-cf-pop: BOS50-C2
    x-amz-cf-id: ae9VbUB4Xpj-1casXP-p4il9miOv8q4tIqXuMnphg_rjV6PJx7vwTw==
    
    HTTP/2 200
    content-type: font/woff
    content-length: 12668
    date: Tue, 09 Jul 2024 17:29:47 GMT
    last-modified: Tue, 09 Jul 2024 15:02:28 GMT
    etag: "fa1cc243e3d39b6db2a569377cce7f89"
    server: AmazonS3
    x-cache: Miss from cloudfront
    via: 1.1 cd9c85933a60bbac347299c34015e9ba.cloudfront.net (CloudFront)
    x-amz-cf-pop: BOS50-C2
    x-amz-cf-id: Zxa3E3E80pPaOZjVKyveBRYn8yrWx6M36xt7LURsZCTwb5BIkLNLlg==
    
  22. gtritchie commented on Jul 9, 2024

    @gtritchie
    Member

    Testing Suggestions

    1. In a web browser, load https://mathjax.rstudio.com/latest/MathJax.js; this should actually load https://mathjax.rstudio.com/2.7.9/MathJax.js
    2. The Javascript displayed should be minified (i.e. not the nicely formatted original source code)
    3. Search the page and ensure you find version string 2.7.9 a bunch of times, and not the older version 2.7.2
    4. In RStudio, create an RMarkdown file and paste in the "Sample Code" below
    5. Knit the file to HTML; confirm preview looks correct (see "Preview Screenshot" below)
    6. Go to filesystem and open the generated HTML file in a web browser
    7. Confirm it looks correct (same as preview), open developer tools / Network, and confirm there are successful fetches from mathjax.rstudio.com (see "Web Browser Example" below)

    Sample Code

    ---
    title: "Test"
    output: 
      html_document:
        self_contained: false
        math_method:
          engine: mathjax
    ---
    
    $$
    x + y
    $$

    Preview Screenshot

    screenshot of preview

    Web Browser Example

    testing-html
  23. ronblum commented on Jul 11, 2024

    @ronblum
    ContributorAuthor

    Verified using the above steps (thank you @gtritchie !) in RStudio Desktop 2024.07.0-daily+303 on Windows 11. Also added a few extra examples just to make sure nothing in the math has gone awry.

    Source mode:

    ---
    title: "Test"
    output: 
      html_document:
        self_contained: false
        math_method:
          engine: mathjax
    ---
    
    $$
    x + y
    $$
    
    $x + 82$
    
    $x / 12 + 56$
    
    $$\int_0^1 x^2 \,dx= \frac13$$ $$\int_0^1 \int_0^{2\pi} r \,d\varphi\,dr$$ $$\iint_{x^2+y^2\le 1} x+y \,dx\,dy$$
    

    Visual mode:

    Image

  24. cderv commented on Jul 11, 2024

    @cderv
    Collaborator

    Great thank you all !

  25. aja08379 commented on Aug 15, 2024

    @aja08379

    @cderv @ronblum am I correct in thinking that this will only appear in Cranberry Hibiscus and the current dailies?

  26. cderv commented on Aug 15, 2024

    @cderv
    Collaborator

    @aja08379 the hosted version has been updated. This version is used by rmarkdown itself, independently of the IDE version.

    I don't think the IDE uses this version directly, but maybe it does (for mathjax preview of math in notebook maybe ?)

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions