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

MathJax not rendered in exported static HTML #1987

Closed
mdAshford opened this issue Mar 16, 2022 · 7 comments · Fixed by #1993 or #2803
Closed

MathJax not rendered in exported static HTML #1987

mdAshford opened this issue Mar 16, 2022 · 7 comments · Fixed by #1993 or #2803
Labels
publishing Notebooks as static documents on the web

Comments

@mdAshford
Copy link

mdAshford commented Mar 16, 2022

simpleMJX jl-staticHTMLexport

MathJax is not rendered in exported Static HTML.

This gist contains the Pluto notebook and its static html export.
https://gist.github.com/mdAshford/2a7debbe3b022b88146cdc7d150cfa8f

I'm running Pluto.jl v0.18.2

The offending code in the exported html appears to be in the script tag where MathJax is loaded. (line 56 in the gist).
Changing not-the-src-yet="https://cdn... to src="https://cdn... solves the problem.

<!-- This script will be enabled by JS after the notebook has initialized to prevent taking up bandwidth during the initial load. -->
<script type="text/javascript" id="MathJax-script" not-the-src-yet="https://cdn.jsdelivr.net/npm/mathjax@3.1.2/es5/tex-svg-full.js" async></script>

Thanks for a great platform!

@Pangoraw
Copy link
Collaborator

@fonsp I don't really know how to test locally but the issue is that the setup_mathjax is not called for static exports anymore because there is only one component render. A possible fix is calling setup_mathjax in the constructor for static previews: 251af10

@likanzhan
Copy link

Same issue being encountered.

ctrekker added a commit that referenced this issue Mar 18, 2022
@fonsp fonsp linked a pull request Mar 18, 2022 that will close this issue
fonsp added a commit that referenced this issue Mar 18, 2022
Co-authored-by: Fons van der Plas <fonsvdplas@gmail.com>
@fonsp fonsp added the publishing Notebooks as static documents on the web label Oct 30, 2023
@rgouveiamendes
Copy link

I think this problem came back. You can check it here: https://rgouveiamendes.org/teaching/iscte-iul/econometrics-i/notebooks/Capitulo01
Screenshot 2024-02-06 125429

The browser tells me the following:
Screenshot 2024-02-06 201120

@fonsp
Copy link
Owner

fonsp commented Feb 6, 2024

It seems to work on my computer! Did you update the notebook since you posted your comment?

@rgouveiamendes
Copy link

rgouveiamendes commented Feb 6, 2024

I am not sure if I have understood your question. Do you mean if I refreshed the page? Yes, I did in both Firefox and Brave. with the same results and the same errors printed in the browser console log.

EDIT: If you are asking if I made any changes to the Notebook in the meantime, no I did not.

@rgouveiamendes
Copy link

To make it totally clear: the problem is with the static HTML version of the Notebook. The active version renders the math perfectly. This thread in discourse https://discourse.julialang.org/t/math-not-displaying-properly-in-static-html-pluto-notebook/109790/4 has a user with a Mac experiencing the same problem. It seems that using PlutoPlotly.jl fixes the problem because, as far as I understand (which is not very far...), it forces Matjax to run locally.

@fonsp
Copy link
Owner

fonsp commented Feb 7, 2024

Thanks! @rgouveiamendes in the future, be sure to crosslink when you make the same post in two places, otherwise you might cause the community to spend double work to help you. I will close this thread

Repository owner locked and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
publishing Notebooks as static documents on the web
Projects
None yet
5 participants