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> <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) }} {{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
<script type="text/x-mathjax-config"> <script type="text/javascript">
MathJax.Hub.Config({ window.MathJax = {
{{ if or .Params.mathjaxEnableSingleDollar (and .Site.Params.mathjaxEnableSingleDollar (ne .Params.mathjaxEnableSingleDollar false)) -}} {{ if or .Params.mathjaxEnableSingleDollar (and .Site.Params.mathjaxEnableSingleDollar (ne .Params.mathjaxEnableSingleDollar false)) -}}
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
{{ end -}} {{ end -}}
showProcessingMessages: false, showProcessingMessages: false,
messageStyle: 'none' messageStyle: 'none'
}); };
</script> </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> <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 }} {{- end }}