Ver código fonte

mathjax: Improve handling of long equations

* Use automatic linebreak feature instead of CSS overflow scrolling
* Disable mathjax notifications
* Highlight any undefined macros within equations
* Load output processors with `-full` option rather than on demand
* Update MathJax version

Fix #496
Fix #586
George Cushen 7 anos atrás
pai
commit
a555dd792b
3 arquivos alterados com 10 adições e 9 exclusões
  1. 2 2
      data/sri.toml
  2. 0 4
      layouts/partials/css/academic.css
  3. 8 3
      layouts/partials/footer.html

+ 2 - 2
data/sri.toml

@@ -17,8 +17,8 @@
   version = "9.12.0"
   sri = "sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw="
 [js.mathJax]
-  version = "2.7.1"
-  sri = "sha512-tOav5w1OjvsSJzePRtt2uQPFwBoHt1VZcUq8l8nm5284LEKE9FSJBQryzMBzHxY5P0zRdNqEcpLIRVYFNgu1jw=="
+  version = "2.7.4"
+  sri = "sha256-GhM+5JHb6QUzOQPXSJLEWP7R73CbkisjzK5Eyij4U9w="
 [js.isotope]
   version = "3.0.4"
   sri = "sha512-VDBOIlDbuC4VWxGJNmuFRQ0Li0SKkDpmGyuhAG5LTDLd/dJ/S0WMVxriR2Y+CyPL5gzjpN4f/6iqWVBJlht0tQ=="

+ 0 - 4
layouts/partials/css/academic.css

@@ -183,10 +183,6 @@ pre code {
   overflow-x: auto;
 }
 
-.mjx-chtml {
-  overflow-x: auto; /* Horizontally scroll long equations. */
-}
-
 hr {
   border: 0;
   height: 1px;

+ 8 - 3
layouts/partials/footer.html

@@ -64,12 +64,17 @@
     <!-- LaTeX math rendering -->
     {{ if or .Params.math .Site.Params.math }}
     <script type="text/x-mathjax-config">
-        MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } });
+      MathJax.Hub.Config({
+        CommonHTML: { linebreaks: { automatic: true } },
+        tex2jax: { inlineMath: [ ['$', '$'], ['\\(','\\)'] ], displayMath: [ ['$$','$$'], ['\\[', '\\]'] ], processEscapes: false },
+        TeX: { noUndefined: { attributes: { mathcolor: 'red', mathbackground: '#FFEEEE', mathsize: '90%' } } },
+        messageStyle: 'none'
+      });
     </script>
     {{ if not .Site.Params.disable_sri }}
-    {{ printf "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/%s/MathJax.js?config=TeX-AMS_CHTML\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" $js.mathJax.version $js.mathJax.sri | safeHTML }}
+    {{ printf "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/%s/MathJax.js?config=TeX-AMS_CHTML-full\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" $js.mathJax.version $js.mathJax.sri | safeHTML }}
     {{ else }}
-    <script async src="//cdnjs.cloudflare.com/ajax/libs/mathjax/{{- $js.mathJax.version -}}/MathJax.js?config=TeX-AMS_CHTML"></script>
+    <script async src="//cdnjs.cloudflare.com/ajax/libs/mathjax/{{- $js.mathJax.version -}}/MathJax.js?config=TeX-AMS_CHTML-full"></script>
     {{ end }}
     {{ end }}