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

Math does not get rendered #283

Closed
rubik opened this issue Oct 19, 2012 · 31 comments
Closed

Math does not get rendered #283

rubik opened this issue Oct 19, 2012 · 31 comments

Comments

@rubik
Copy link

rubik commented Oct 19, 2012

I use MathJax in my project documentation and it does not get rendered!
I think this is the same of #99, not sure why that one was closed...

EDIT: This is what I mean:
https://radon.readthedocs.org/en/latest/intro.html#maintainability-index

You can see that there is a weird [MI escape instead of the formulas.

@vrajmohan
Copy link

@vrajmohan
Copy link

Correction - I was able to see the formulas using Firefox 16.0.2 but not with Chrome Version 23.0.1271.64.
Chrome complained saying that the page has insecure content. When I chose to load the insecure content anyway, the formulas were correctly displayed.

Further investigation revealed that the JavaScript console on Chrome was reporting:
[blocked] The page at https://radon.readthedocs.org/en/latest/intro.html#maintainability-index ran insecure content from http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.
[blocked] The page at https://radon.readthedocs.org/en/latest/intro.html#maintainability-index ran insecure content from http://fonts.googleapis.com/css?family=PT+Mono|Open+Sans:300italic,400italic,700italic,400,300,700.
[blocked] The page at https://radon.readthedocs.org/en/latest/intro.html#maintainability-index ran insecure content from http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.
[blocked] The page at https://radon.readthedocs.org/en/latest/intro.html#maintainability-index ran insecure content from http://fonts.googleapis.com/css?family=PT+Mono|Open+Sans:300italic,400italic,700italic,400,300,700.

@rubik
Copy link
Author

rubik commented Nov 18, 2012

Thanks for the help. I'm using Chromium version 23.0.1271.64 (165188). It seems that the insecure content that Chrome complains about is some Javascript from MathJax. I found the following wiki section about this issue:
http://www.mediawiki.org/wiki/Extension_talk:MathJax#.5BFIXED.5D_MathJax_fails_to_render_in_Chrome

So apparently we just need to change MathJax url in Sphinx/Readthedocs conf.py, I'll dig Sphinx docs.

@vrajmohan
Copy link

@pao
Copy link

pao commented May 27, 2013

This is going to break for Firefox users very soon due to bug 834836 (release notes). This is currently in Aurora, and should be expected to hit release August 6.

@rubik
Copy link
Author

rubik commented May 30, 2013

Hmm thanks for the report. So there is no workaround?

@pao
Copy link

pao commented May 30, 2013

I think if you wanted a straight workaround, you'd need to pull in MathJax.js as a static file and would probably have to override one of the templates. But I suspect that figuring out how to fix it in readthedocs.org's templates would be better (and everyone would get to take advantage, then.)

@pao
Copy link

pao commented May 31, 2013

This actually looks to be driven by sphinx.ext.mathjax, which points at the CDN by default. One possible workaround would be to place a local JS file in your static folder which looks something like this (haven't tested yet):

  var mathjax_host = (
      ("https:" == document.location.protocol) 
      ? "https://c328740.ssl.cf1.rackcdn.com/" 
      : "http://cdn.mathjax.org/"
  );
  document.write(
      unescape(
          "%3Cscript"
              + " src='"
                  + mathjax_host
                  + "mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
              + "'"
              + " type='text/javascript'
          + "%3E"
          + "%3C/script%3E"
      ) // this HAS to be escaped, otherwise it would 
        // close the actual (not injected) <script> element
  );

Then, set mathjax_path in conf.py to point where that static file will end up. (JS cribbed from http://stackoverflow.com/a/2725730/105880)

@cdeil
Copy link

cdeil commented Sep 13, 2013

I have the same problem with this page ... mathjax works with Safari, but not Chrome.

Is it possible to implement a workaround in readthedocs so that not every project has to (I didn't try to snippet by @pao yet).

@hit9
Copy link

hit9 commented Sep 30, 2013

any updates on this issues? I meet the same problem now..

@rubik
Copy link
Author

rubik commented Sep 30, 2013

Apparently it's solved by adding this line in conf.py:

mathjax_path = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'

Obviously the MathJax extension must be added as well to the corresponding setting variable. As you can see, now it gets rendered:
http://radon.readthedocs.org/en/latest/intro.html

On Chrome, at least. For me, the issue is solved and can be closed.

@hit9
Copy link

hit9 commented Oct 1, 2013

@rubik thanks a lot !

@rubik
Copy link
Author

rubik commented Oct 1, 2013

@hit9 No problem, happy to help! Did you solved the issue?

@hit9
Copy link

hit9 commented Oct 1, 2013

@rubik It seems works. http://curdpy.readthedocs.org/ Fonts on google.com display well.

@hit9
Copy link

hit9 commented Oct 1, 2013

@rubik but, it goes back into that problem a short time later. ..

@rubik
Copy link
Author

rubik commented Oct 1, 2013

@hit9 That's weird! My page still works as expected. Are you sure that it isn't another problem?

@pao
Copy link

pao commented Oct 1, 2013

@hit9 @rubik both links to radon and curdpy are http, not https--the CDN works perfectly fine on the non-SSL site.

@hit9
Copy link

hit9 commented Oct 2, 2013

@rubik @pao Yep. http ok, but https still blocked.

@ericholscher
Copy link
Member

mathjax_path = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'

Should work for both http and https.

Cheers,
Eric

On Tue, Oct 1, 2013 at 8:23 PM, 王超 notifications@github.com wrote:

@rubik https://github.com/rubik @pao https://github.com/pao Yep. http
ok, but https still blocked.


Reply to this email directly or view it on GitHubhttps://github.com//issues/283#issuecomment-25511085
.

Eric Holscher
Maker of the internet residing in Portland, Or
http://ericholscher.com

@hit9
Copy link

hit9 commented Oct 2, 2013

@ericholscher I tested your solution, but not work with https.

Commit is here: hit9/skylark@2b5d4df

@jodal
Copy link
Member

jodal commented Oct 2, 2013

I think you should remove the part inside the < and > quotes. I think it was only included in Eric's reply because of the conversion from his email reply to an GitHub Issues comment.

@ericholscher
Copy link
Member

Ah, indeed. Sorry.

mathjax_path = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'

@hit9
Copy link

hit9 commented Oct 2, 2013

oh.. I updated that line to

mathjax_path = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'

https still blocked... http is always ok.

@pao
Copy link

pao commented Oct 2, 2013

That's not a surprise--as explained at http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn posted by @vrajmohan the URLs are not the same, hence the need for the stupidly complicated JS snippet.

@ericholscher
Copy link
Member

You should be able to safely always point to https, and it will work fine on http.

@pao
Copy link

pao commented Oct 7, 2013

Except now you have mixed active content again.

@ericholscher
Copy link
Member

an http page including an https link won't cause any issue that I know of. Lots of pages do it all the time.

@pao
Copy link

pao commented Oct 7, 2013

Sorry, you're quite right that I had that backwards. Maybe it's time to pull request a universal switch to the SSL CDN address?

@ericholscher
Copy link
Member

Seems reasonable, as long as the SSL CDN isn't costing you ton of money.

On Mon, Oct 7, 2013 at 12:21 PM, pao notifications@github.com wrote:

Sorry, you're quite right that I had that backwards. Maybe it's time to
pull request a universal switch to the SSL CDN address?


Reply to this email directly or view it on GitHubhttps://github.com//issues/283#issuecomment-25837118
.

Eric Holscher
Maker of the internet residing in Portland, Or
http://ericholscher.com

@pao
Copy link

pao commented Oct 7, 2013

I've no idea how MathJax's hosting is funded.

@ericholscher
Copy link
Member

Closing this now.

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

No branches or pull requests

7 participants