Add katex

pull/26/head
James Panther 2021-11-03 17:06:57 +11:00
parent 47d49fcaf0
commit 355667eec3
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
5 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var a={};return function(){n.d(a,{default:function(){return s}});var e=n(771),t=n.n(e),r=function(e,t,r){for(var n=r,a=0,i=e.length;n<t.length;){var o=t[n];if(a<=0&&t.slice(n,n+i)===e)return n;"\\"===o?n++:"{"===o?a++:"}"===o&&a--,n++}return-1},i=/^\\begin{/,o=function(e,t){for(var n,a=[],o=new RegExp("("+t.map((function(e){return e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")})).join("|")+")");-1!==(n=e.search(o));){n>0&&(a.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));var l=t.findIndex((function(t){return e.startsWith(t.left)}));if(-1===(n=r(t[l].right,e,t[l].left.length)))break;var d=e.slice(0,n+t[l].right.length),s=i.test(d)?d:e.slice(t[l].left.length,n);a.push({type:"math",data:s,rawData:d,display:t[l].display}),e=e.slice(n+t[l].right.length)}return""!==e&&a.push({type:"text",data:e}),a},l=function(e,r){var n=o(e,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;for(var a=document.createDocumentFragment(),i=0;i<n.length;i++)if("text"===n[i].type)a.appendChild(document.createTextNode(n[i].data));else{var l=document.createElement("span"),d=n[i].data;r.displayMode=n[i].display;try{r.preProcess&&(d=r.preProcess(d)),t().render(d,l,r)}catch(e){if(!(e instanceof t().ParseError))throw e;r.errorCallback("KaTeX auto-render: Failed to parse `"+n[i].data+"` with ",e),a.appendChild(document.createTextNode(n[i].rawData));continue}a.appendChild(l)}return a},d=function e(t,r){for(var n=0;n<t.childNodes.length;n++){var a=t.childNodes[n];if(3===a.nodeType){var i=l(a.textContent,r);i&&(n+=i.childNodes.length-1,t.replaceChild(i,a))}else 1===a.nodeType&&function(){var t=" "+a.className+" ";-1===r.ignoredTags.indexOf(a.nodeName.toLowerCase())&&r.ignoredClasses.every((function(e){return-1===t.indexOf(" "+e+" ")}))&&e(a,r)}()}},s=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},d(e,r)}}(),a=a.default}()}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

43
package-lock.json generated
View File

@ -12,6 +12,7 @@
"devDependencies": { "devDependencies": {
"@tailwindcss/typography": "^0.4.1", "@tailwindcss/typography": "^0.4.1",
"chart.js": "^3.6.0", "chart.js": "^3.6.0",
"katex": "^0.15.1",
"mermaid": "^8.13.3", "mermaid": "^8.13.3",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"prettier-plugin-go-template": "^0.0.11", "prettier-plugin-go-template": "^0.0.11",
@ -1755,6 +1756,31 @@
"graceful-fs": "^4.1.6" "graceful-fs": "^4.1.6"
} }
}, },
"node_modules/katex": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/katex/-/katex-0.15.1.tgz",
"integrity": "sha512-KIk+gizli0gl1XaJlCYS8/donGMbzXYTka6BbH3AgvDJTOwyDY4hJ+YmzJ1F0y/3XzX5B9ED8AqB2Hmn2AZ0uA==",
"dev": true,
"funding": [
"https://opencollective.com/katex",
"https://github.com/sponsors/katex"
],
"dependencies": {
"commander": "^8.0.0"
},
"bin": {
"katex": "cli.js"
}
},
"node_modules/katex/node_modules/commander": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
"integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
"dev": true,
"engines": {
"node": ">= 12"
}
},
"node_modules/khroma": { "node_modules/khroma": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/khroma/-/khroma-1.4.1.tgz", "resolved": "https://registry.npmjs.org/khroma/-/khroma-1.4.1.tgz",
@ -3936,6 +3962,23 @@
"universalify": "^2.0.0" "universalify": "^2.0.0"
} }
}, },
"katex": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/katex/-/katex-0.15.1.tgz",
"integrity": "sha512-KIk+gizli0gl1XaJlCYS8/donGMbzXYTka6BbH3AgvDJTOwyDY4hJ+YmzJ1F0y/3XzX5B9ED8AqB2Hmn2AZ0uA==",
"dev": true,
"requires": {
"commander": "^8.0.0"
},
"dependencies": {
"commander": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
"integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
"dev": true
}
}
},
"khroma": { "khroma": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/khroma/-/khroma-1.4.1.tgz", "resolved": "https://registry.npmjs.org/khroma/-/khroma-1.4.1.tgz",

View File

@ -30,6 +30,7 @@
"devDependencies": { "devDependencies": {
"@tailwindcss/typography": "^0.4.1", "@tailwindcss/typography": "^0.4.1",
"chart.js": "^3.6.0", "chart.js": "^3.6.0",
"katex": "^0.15.1",
"mermaid": "^8.13.3", "mermaid": "^8.13.3",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"prettier-plugin-go-template": "^0.0.11", "prettier-plugin-go-template": "^0.0.11",
@ -38,7 +39,8 @@
"tailwindcss": "^2.2.17", "tailwindcss": "^2.2.17",
"vendor-copy": "^3.0.1" "vendor-copy": "^3.0.1"
}, },
"vendorCopy": [ "vendorCopy": [],
"devVendorCopy": [
{ {
"from": "node_modules/mermaid/dist/mermaid.min.js", "from": "node_modules/mermaid/dist/mermaid.min.js",
"to": "assets/vendor/mermaid/mermaid.min.js" "to": "assets/vendor/mermaid/mermaid.min.js"
@ -46,6 +48,18 @@
{ {
"from": "node_modules/chart.js/dist/chart.min.js", "from": "node_modules/chart.js/dist/chart.min.js",
"to": "assets/vendor/chart/chart.min.js" "to": "assets/vendor/chart/chart.min.js"
},
{
"from": "node_modules/katex/dist/katex.min.js",
"to": "assets/vendor/katex/katex.min.js"
},
{
"from": "node_modules/katex/dist/katex.min.css",
"to": "assets/vendor/katex/katex.min.css"
},
{
"from": "node_modules/katex/dist/contrib/auto-render.min.js",
"to": "assets/vendor/katex/auto-render.min.js"
} }
] ]
} }