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

Bug: inlining mathjax 3.0 in html fails to load properly [2.10.1] #6599

Closed
gabyx opened this issue Aug 6, 2020 · 5 comments · Fixed by #6600
Closed

Bug: inlining mathjax 3.0 in html fails to load properly [2.10.1] #6599

gabyx opened this issue Aug 6, 2020 · 5 comments · Fixed by #6600

Comments

@gabyx
Copy link

gabyx commented Aug 6, 2020

It's probably not a pandoc bug (maybe special character escaping or so?)

Reproduce:

echo '$asd$' | pandoc -f markdown+tex_math_dollars --standalone --self-contained --mathjax -t html5 > Content.html

Output:
Correct HTML which does not load in Chrome properly because mathjax (I assume) has html tags in the source ,r.write('<html><head><

Can this somehow be fixed? Escping special characters in the source .js ??

@jgm
Copy link
Owner

jgm commented Aug 6, 2020

Did --self-contained work with earlier versions of MathJax?
My experience has been that it never worked. MathJax needs to load a bunch of stuff dynamically (or it used to), and pandoc's self-contained algorithm isn't smart enough to interpret JavaScript and include this.

@ickc
Copy link
Contributor

ickc commented Aug 6, 2020

Is pandoc using TeX-AMS_HTML-full everywhere (I only see that it is on the realjs template)? I think years ago I submitted a PR so that pandoc uses the -full variant. If so, it is a self-contained js that will not need dynamic loading of other js. It might still loads some web-fonts. The situation may also change slightly after MathJax 3.0.

@ickc
Copy link
Contributor

ickc commented Aug 6, 2020

Oh, c.f. d8ad766 , may be it is not using the full variant now.

@jgm
Copy link
Owner

jgm commented Aug 7, 2020

Unescaped HTML inside a script tag shouldn't be a problem, should it?

I tried the command listed above. Content.html loaded fine in both Safari and Chrome. JavaScript console gave three errors, all because of math fonts that could not be loaded. So I don't think there's a problem here other than the (already known) problem of math fonts.

@gabyx
Copy link
Author

gabyx commented Aug 7, 2020

I close this, because I think its suceptical to some weird extension in Chrome which give syntax error in this script!

@gabyx gabyx closed this as completed Aug 7, 2020
jgm pushed a commit that referenced this issue Oct 10, 2020
…chtml (#6600)

Closes #6599

c.f. https://docs.mathjax.org/en/latest/web/components/combined.html

Note that while this use the full variant of the js, this drops the mathml support.
That should be okay, because pandoc renders math in HTML as TeX when using
mathjax.

This change reduces latency.
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 a pull request may close this issue.

3 participants