From 30850ff725aa5c12d7951c777e10bb9d343e85ba Mon Sep 17 00:00:00 2001
From: Bobby <bobbywlindsey@users.noreply.github.com>
Date: Mon, 21 Oct 2019 17:09:19 +0000
Subject: [PATCH] Make LaTeX compatible with MathJax version 3 (#230)

---
 layouts/partials/posts/math.html |   36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/layouts/partials/posts/math.html b/layouts/partials/posts/math.html
index 658d3b5..c64a187 100644
--- a/layouts/partials/posts/math.html
+++ b/layouts/partials/posts/math.html
@@ -1,25 +1,23 @@
 {{- if .Params.math -}}
-  <script type="text/javascript" async
-    src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
-    MathJax.Hub.Config({
-      tex2jax: {
-        inlineMath: [['$','$']],
-        displayMath: [['$$','$$']],
+  <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
+  <script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
+  <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/startup.js" id="MathJax-script"></script>
+  <script>
+    MathJax = {
+      tex: {
+        inlineMath: [
+          ['$', '$']
+        ],
+        displayMath: [
+          ['$$', '$$']
+        ],
         processEscapes: true,
-        processEnvironments: true,
-        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
-        TeX: { extensions: ["AMSmath.js", "AMSsymbols.js"] }
+        processEnvironments: true
+      },
+      options: {
+        skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
       }
-    });
-    MathJax.Hub.Queue(function() {
-      // Fix <code> tags after MathJax finishes running. This is a
-      // hack to overcome a shortcoming of Markdown. Discussion at
-      // https://github.com/mojombo/jekyll/issues/199
-      var all = MathJax.Hub.getAllJax(), i;
-      for(i = 0; i < all.length; i += 1) {
-          all[i].SourceElement().parentNode.className += ' has-jax';
-      }
-    });
+    };
   </script>
 {{- end -}}
 {{- if .Params.katex -}}

--
Gitblit v1.10.0