commit cd81f2bbf5e2d01da58110ae01b583f090acc941
parent 540e0332894822168f990f03149010b734ec663d
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date: Tue, 29 May 2018 00:05:42 -0500
Change how LaTeX is parsed and async js.
Diffstat:
2 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html
@@ -1,6 +1,7 @@
<hr/>
<link rel="stylesheet" href="{{ "/css/isso.css" | relURL }}" type="text/css" />
-<script data-isso="/isso/"
+<script async
+ data-isso="/isso/"
data-isso-css="false"
data-isso-lang={{ .Site.Language }}
data-isso-reply-to-self="false"
diff --git a/layouts/partials/katex.html b/layouts/partials/katex.html
@@ -1,26 +1,3 @@
-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/katex.min.css" integrity="sha384-BTL0nVi8DnMrNdMQZG1Ww6yasK9ZGnUxL1ZWukXQ7fygA1py52yPp9W4wrR00VML" crossorigin="anonymous">
+<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/katex.min.css" integrity="sha384-BTL0nVi8DnMrNdMQZG1Ww6yasK9ZGnUxL1ZWukXQ7fygA1py52yPp9W4wrR00VML" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/katex.min.js" integrity="sha384-y6SGsNt7yZECc4Pf86XmQhC4hG2wxL6Upkt9N1efhFxfh6wlxBH0mJiTE8XYclC1" crossorigin="anonymous"></script>
-<script src="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/contrib/auto-render.min.js" integrity="sha384-IiI65aU9ZYub2MY9zhtKd1H2ps7xxf+eb2YFG9lX6uRqpXCvBTOidPRCXCrQ++Uc" crossorigin="anonymous"></script>
-<script type="text/javascript">
-(function() {
- var i, text, code, codes = document.getElementsByTagName('code');
- for (i = 0; i < codes.length;) {
- code = codes[i];
- if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
- text = code.textContent;
- if (/^\$[^$]/.test(text) && /[^$]\$$/.test(text)) {
- text = text.replace(/^\$/, '\\(').replace(/\$$/, '\\)');
- code.textContent = text;
- }
- if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
- /^\$(.|\s)+\$$/.test(text) ||
- /^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
- code.outerHTML = code.innerHTML; // remove <code></code>
- continue;
- }
- }
- i++;
- }
-})();
-renderMathInElement(document.body);
-</script>
+<script async defer onload="renderMathInElement(document.body);" src="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/contrib/auto-render.min.js" integrity="sha384-IiI65aU9ZYub2MY9zhtKd1H2ps7xxf+eb2YFG9lX6uRqpXCvBTOidPRCXCrQ++Uc" crossorigin="anonymous"></script>