Skip to content

Commit 420c1c3

Browse files
committed
[SPARK-2252] Fix MathJax for HTTPs.
Found out about this from the Hacker News link to GraphX which was using HTTPs. @mengxr Author: Reynold Xin <[email protected]> Closes #1189 from rxin/mllib-doc and squashes the following commits: 5328be0 [Reynold Xin] [SPARK-2252] Fix MathJax for HTTPs.
1 parent 56eb8af commit 420c1c3

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

docs/_layouts/global.html

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,31 @@ <h1 class="title">{{ page.title }}</h1>
136136

137137
<!-- MathJax Section -->
138138
<script type="text/x-mathjax-config">
139-
MathJax.Hub.Config({
139+
MathJax.Hub.Config({
140140
TeX: { equationNumbers: { autoNumber: "AMS" } }
141-
});
142-
</script>
143-
<script type="text/javascript"
144-
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
141+
});
142+
</script>
145143
<script>
146-
MathJax.Hub.Config({
147-
tex2jax: {
148-
inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ],
149-
displayMath: [ ["$$","$$"], ["\\[", "\\]"] ],
150-
processEscapes: true,
151-
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
152-
}
153-
});
144+
// Note that we load MathJax this way to work with local file (file://), HTTP and HTTPS.
145+
// We could use "//cdn.mathjax...", but that won't support "file://".
146+
(function(d, script) {
147+
script = d.createElement('script');
148+
script.type = 'text/javascript';
149+
script.async = true;
150+
script.onload = function(){
151+
MathJax.Hub.Config({
152+
tex2jax: {
153+
inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ],
154+
displayMath: [ ["$$","$$"], ["\\[", "\\]"] ],
155+
processEscapes: true,
156+
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
157+
}
158+
});
159+
};
160+
script.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
161+
'cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
162+
d.getElementsByTagName('head')[0].appendChild(script);
163+
}(document));
154164
</script>
155165
</body>
156166
</html>

0 commit comments

Comments
 (0)