如何在GitHub wiki页面上插入javascript以启用MathJax



GitHub wiki页面不再支持MathJax。这似乎像dotjs Chrome扩展可能是一种方式,使MathJax在这些页面。

这是我第一次尝试创建在github.com页面上执行的javascript,并插入启用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控制台出现以下错误:

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?

我认为问题出在MathJax的源代码中因为它使用了eval函数

最新更新