2013-06-03 25 views
5

GitHub维客页面不再支持MathJax。似乎dotjs Chrome extension可能是在这些页面上启用MathJax的一种方式。如何在GitHub wiki页面插入javascript以启用MathJax?

这是我创造的JavaScript将执行上github.com网页,并插入使MathJax需要合适的代码第一次尝试:但是

[~]$ cat .js/github.com.js 
(function() { 
    var script = document.createElement("script"); 
    script.type = "text/javascript"; 
    script.src = "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; 
    document.getElementsByTagName("head")[0].appendChild(script); 
})(); 

这不起作用,并出现以下错误出现在Chrome JavaScript Console中:

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 
https://github.com https://a248.e.akamai.net https://jobs.github.com https://ssl.google-analytics.com https://secure.gaug.es https://collector.githubapp.com https://gist.github.com". 
    c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML:29 

什么是正确的JavaScript?

+0

现在你知道_why_ GitHub上不再支持MathJax。 MathJax不适用于CSP。 https://github.com/blog/1477-content-security-policy – SLaks

+0

https://github.com/mathjax/MathJax/issues/256 – SLaks

+0

这是否意味着我不能做我想做的事情,除非MathJax兼容与CSP? – Michael

回答

0

我认为这个问题是在MathJax的源代码,因为它使用的eval函数有