refactor: configure mathjax using plain javascript

If you use `x-mathjax-config` with CSP enabled, you will need to add 'unsafe-eval' to your CSP policy.
This commit is contained in:
olOwOlo 2018-02-13 16:19:47 +08:00
parent 33594c0d13
commit 28b4c8a5dd
No known key found for this signature in database
GPG key ID: 456394B6E7A15EA6

View file

@ -12,14 +12,14 @@
<script type="text/javascript" src="{{ "dist/even.min.js?v=3.0.0" | relURL }}"></script>
{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
<script type="text/javascript">
window.MathJax = {
{{ if or .Params.mathjaxEnableSingleDollar (and .Site.Params.mathjaxEnableSingleDollar (ne .Params.mathjaxEnableSingleDollar false)) -}}
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
{{ end -}}
showProcessingMessages: false,
messageStyle: 'none'
});
};
</script>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
{{- end }}