Browse Source

Move mathjax config to the bottom

simov 7 years ago
parent
commit
28b0c84f49
1 changed files with 45 additions and 43 deletions
  1. 45 43
      content/content.js

+ 45 - 43
content/content.js

@@ -88,49 +88,7 @@ function mount () {
             $('body').classList.add('_toc-left')
           }
           if (state.content.mathjax) {
-            dom.push(m('script', {type: 'text/x-mathjax-config',}, `
-              // TeX-AMS_HTML
-              MathJax.Hub.Config({
-                jax: [
-                  'input/TeX',
-                  'output/HTML-CSS',
-                  'output/PreviewHTML',
-                ],
-                extensions: [
-                  'tex2jax.js',
-                  'AssistiveMML.js',
-                  'a11y/accessibility-menu.js',
-                ],
-                TeX: {
-                  extensions: [
-                    'AMSmath.js',
-                    'AMSsymbols.js',
-                    'noErrors.js',
-                    'noUndefined.js',
-                  ]
-                },
-                tex2jax: {
-                  inlineMath: [
-                    ['$', '$'],
-                    ['\\\\(', '\\\\)'],
-                  ],
-                  displayMath: [
-                    ['$$', '$$'],
-                    ['\\\\[', '\\\\]'],
-                  ],
-                  processEscapes: true
-                },
-                showMathMenu: false,
-                showProcessingMessages: false,
-                messageStyle: 'none',
-                skipStartupTypeset: true, // disable initial rendering
-                positionToHash: false
-              })
-              // set specific container to render, can be delayed too
-              MathJax.Hub.Queue(
-                ['Typeset', MathJax.Hub, '_html']
-              )
-            `))
+            dom.push(m('script', {type: 'text/x-mathjax-config'}, mathjax))
             dom.push(m('script', {
               src: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js'
             }))
@@ -267,3 +225,47 @@ if (state.content.autoreload) {
     state.interval = setInterval(get, state.ms)
   })()
 }
+
+var mathjax = `
+  // TeX-AMS_HTML
+  MathJax.Hub.Config({
+    jax: [
+      'input/TeX',
+      'output/HTML-CSS',
+      'output/PreviewHTML',
+    ],
+    extensions: [
+      'tex2jax.js',
+      'AssistiveMML.js',
+      'a11y/accessibility-menu.js',
+    ],
+    TeX: {
+      extensions: [
+        'AMSmath.js',
+        'AMSsymbols.js',
+        'noErrors.js',
+        'noUndefined.js',
+      ]
+    },
+    tex2jax: {
+      inlineMath: [
+        ['$', '$'],
+        ['\\\\(', '\\\\)'],
+      ],
+      displayMath: [
+        ['$$', '$$'],
+        ['\\\\[', '\\\\]'],
+      ],
+      processEscapes: true
+    },
+    showMathMenu: false,
+    showProcessingMessages: false,
+    messageStyle: 'none',
+    skipStartupTypeset: true, // disable initial rendering
+    positionToHash: false
+  })
+  // set specific container to render, can be delayed too
+  MathJax.Hub.Queue(
+    ['Typeset', MathJax.Hub, '_html']
+  )
+`