Load MathJax config without eval() (#735)

This allows stricter content security policies for 
`Content-Security-Policy` header.
This commit is contained in:
Thom Wiggers authored and gcushen committed 2018-10-21 20:32:44 +01:00
1 parent b7c4001ab0
commit 8d8cddfdb2
2 files changed
+9 -8

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
window.MathJax = {
CommonHTML: { linebreaks: { automatic: true } },
tex2jax: { inlineMath: [ ['$', '$'], ['\\(','\\)'] ], displayMath: [ ['$$','$$'], ['\\[', '\\]'] ], processEscapes: false },
TeX: { noUndefined: { attributes: { mathcolor: 'red', mathbackground: '#FFEEEE', mathsize: '90%' } } },
messageStyle: 'none'
};
+3 -8
View File
@@ -2,14 +2,9 @@
{{/* Config LaTeX math rendering. */}}
{{ if or .Params.math .Site.Params.math }}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
CommonHTML: { linebreaks: { automatic: true } },
tex2jax: { inlineMath: [ ['$', '$'], ['\\(','\\)'] ], displayMath: [ ['$$','$$'], ['\\[', '\\]'] ], processEscapes: false },
TeX: { noUndefined: { attributes: { mathcolor: 'red', mathbackground: '#FFEEEE', mathsize: '90%' } } },
messageStyle: 'none'
});
</script>
{{ $mathjax_config := resources.Get "js/mathjax-config.js" }}
{{ $secureJS := $mathjax_config | resources.Fingerprint "sha512" }}
<script src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
{{ end }}
{{/* Attempt to load local vendor JS, otherwise load from CDN. */}}