katex 0.16.9 → 0.16.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,13 +37,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
37
37
  <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
38
38
  <html>
39
39
  <head>
40
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">
40
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
41
41
 
42
42
  <!-- The loading of KaTeX is deferred to speed up page rendering -->
43
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js" integrity="sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8" crossorigin="anonymous"></script>
43
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
44
44
 
45
45
  <!-- To automatically render math in text elements, include the auto-render extension: -->
46
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
46
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"
47
47
  onload="renderMathInElement(document.body);"></script>
48
48
  </head>
49
49
  ...
@@ -18,7 +18,7 @@ This extension isn't part of KaTeX proper, so the script should be separately
18
18
  included in the page.
19
19
 
20
20
  ```html
21
- <script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/copy-tex.min.js" integrity="sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A" crossorigin="anonymous"></script>
21
+ <script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js" integrity="sha384-HORx6nWi8j5/mYA+y57/9/CZc5z8HnEw4WUZWy5yOn9ToKBv1l58vJaufFAn9Zzi" crossorigin="anonymous"></script>
22
22
  ```
23
23
 
24
24
  (Note that, as of KaTeX 0.16.0, there is no longer a corresponding CSS file.)
@@ -35,5 +35,5 @@ statement with `require('katex/contrib/copy-tex/katex2tex.js')`.
35
35
 
36
36
  ECMAScript module is also available:
37
37
  ```html
38
- <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/copy-tex.mjs" integrity="sha384-bVEnwt0PtX+1EuJoOEcm4rgTUWvb2ILTdjHfI1gUe/r5fdqrTcQaUuRdHG2DciuQ" crossorigin="anonymous"></script>
38
+ <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.mjs" integrity="sha384-bVEnwt0PtX+1EuJoOEcm4rgTUWvb2ILTdjHfI1gUe/r5fdqrTcQaUuRdHG2DciuQ" crossorigin="anonymous"></script>
39
39
  ```
@@ -11,7 +11,7 @@ included in the page, in addition to KaTeX.
11
11
  Load the extension by adding the following line to your HTML file.
12
12
 
13
13
  ```html
14
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
14
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/mathtex-script-type.min.js" integrity="sha384-OGHJvxKrLNowXjZcg7A8ziPZctl4h7FncefPoKSuxgVXFxeM87GCKFJvOaTeBB9q" crossorigin="anonymous"></script>
15
15
  ```
16
16
  You can download the script and use it locally, or from a local KaTeX installation instead.
17
17
 
@@ -23,9 +23,9 @@ Then, in the body, we use a `math/tex` script to typeset the equation `x+\sqrt{1
23
23
  <!DOCTYPE html>
24
24
  <html>
25
25
  <head>
26
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">
27
- <script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js" integrity="sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8" crossorigin="anonymous"></script>
28
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
26
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
27
+ <script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
28
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/mathtex-script-type.min.js" integrity="sha384-OGHJvxKrLNowXjZcg7A8ziPZctl4h7FncefPoKSuxgVXFxeM87GCKFJvOaTeBB9q" crossorigin="anonymous"></script>
29
29
  </head>
30
30
  <body>
31
31
  <script type="math/tex">x+\sqrt{1-x^2}</script>
@@ -35,4 +35,4 @@ Then, in the body, we use a `math/tex` script to typeset the equation `x+\sqrt{1
35
35
 
36
36
  ECMAScript module is also available:
37
37
  ```html
38
- <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script>
38
+ <script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script>
@@ -7,7 +7,7 @@ This extension adds to KaTeX the `\ce` and `\pu` functions from the [mhchem](htt
7
7
  This extension isn't part of core KaTeX, so the script should be separately included. Write the following line into the HTML page's `<head>`. Place it *after* the line that calls `katex.js`, and if you make use of the [auto-render](https://katex.org/docs/autorender.html) extension, place it *before* the line that calls `auto-render.js`.
8
8
 
9
9
  ```html
10
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/mhchem.min.js" integrity="sha384-ifpG+NlgMq0kvOSGqGQxW1mJKpjjMDmZdpKGq3tbvD3WPhyshCEEYClriK/wRVU0" crossorigin="anonymous"></script>
10
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/mhchem.min.js" integrity="sha384-ifpG+NlgMq0kvOSGqGQxW1mJKpjjMDmZdpKGq3tbvD3WPhyshCEEYClriK/wRVU0" crossorigin="anonymous"></script>
11
11
  ```
12
12
 
13
13
  If you remove the `defer` attribute from this tag, then you must also remove the `defer` attribute from the `<script src="https://../katex.min.js">` tag.
package/dist/README.md CHANGED
@@ -37,13 +37,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
37
37
  <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
38
38
  <html>
39
39
  <head>
40
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">
40
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
41
41
 
42
42
  <!-- The loading of KaTeX is deferred to speed up page rendering -->
43
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js" integrity="sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8" crossorigin="anonymous"></script>
43
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
44
44
 
45
45
  <!-- To automatically render math in text elements, include the auto-render extension: -->
46
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
46
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"
47
47
  onload="renderMathInElement(document.body);"></script>
48
48
  </head>
49
49
  ...
@@ -90,15 +90,15 @@ var external_katex_ = __webpack_require__(771);
90
90
  var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
91
91
  ;// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
92
92
  /* eslint no-constant-condition:0 */
93
- var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
93
+ const findEndOfMath = function (delimiter, text, startIndex) {
94
94
  // Adapted from
95
95
  // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
96
- var index = startIndex;
97
- var braceLevel = 0;
98
- var delimLength = delimiter.length;
96
+ let index = startIndex;
97
+ let braceLevel = 0;
98
+ const delimLength = delimiter.length;
99
99
 
100
100
  while (index < text.length) {
101
- var character = text[index];
101
+ const character = text[index];
102
102
 
103
103
  if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
104
104
  return index;
@@ -116,18 +116,16 @@ var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
116
116
  return -1;
117
117
  };
118
118
 
119
- var escapeRegex = function escapeRegex(string) {
119
+ const escapeRegex = function (string) {
120
120
  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
121
121
  };
122
122
 
123
- var amsRegex = /^\\begin{/;
123
+ const amsRegex = /^\\begin{/;
124
124
 
125
- var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
126
- var index;
127
- var data = [];
128
- var regexLeft = new RegExp("(" + delimiters.map(function (x) {
129
- return escapeRegex(x.left);
130
- }).join("|") + ")");
125
+ const splitAtDelimiters = function (text, delimiters) {
126
+ let index;
127
+ const data = [];
128
+ const regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
131
129
 
132
130
  while (true) {
133
131
  index = text.search(regexLeft);
@@ -145,21 +143,19 @@ var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
145
143
  } // ... so this always succeeds:
146
144
 
147
145
 
148
- var i = delimiters.findIndex(function (delim) {
149
- return text.startsWith(delim.left);
150
- });
146
+ const i = delimiters.findIndex(delim => text.startsWith(delim.left));
151
147
  index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
152
148
 
153
149
  if (index === -1) {
154
150
  break;
155
151
  }
156
152
 
157
- var rawData = text.slice(0, index + delimiters[i].right.length);
158
- var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
153
+ const rawData = text.slice(0, index + delimiters[i].right.length);
154
+ const math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
159
155
  data.push({
160
156
  type: "math",
161
157
  data: math,
162
- rawData: rawData,
158
+ rawData,
163
159
  display: delimiters[i].display
164
160
  });
165
161
  text = text.slice(index + delimiters[i].right.length);
@@ -184,8 +180,8 @@ var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
184
180
  * API, we should copy it before mutating.
185
181
  */
186
182
 
187
- var renderMathInText = function renderMathInText(text, optionsCopy) {
188
- var data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
183
+ const renderMathInText = function (text, optionsCopy) {
184
+ const data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
189
185
 
190
186
  if (data.length === 1 && data[0].type === 'text') {
191
187
  // There is no formula in the text.
@@ -194,14 +190,14 @@ var renderMathInText = function renderMathInText(text, optionsCopy) {
194
190
  return null;
195
191
  }
196
192
 
197
- var fragment = document.createDocumentFragment();
193
+ const fragment = document.createDocumentFragment();
198
194
 
199
- for (var i = 0; i < data.length; i++) {
195
+ for (let i = 0; i < data.length; i++) {
200
196
  if (data[i].type === "text") {
201
197
  fragment.appendChild(document.createTextNode(data[i].data));
202
198
  } else {
203
- var span = document.createElement("span");
204
- var math = data[i].data; // Override any display mode defined in the settings with that
199
+ const span = document.createElement("span");
200
+ let math = data[i].data; // Override any display mode defined in the settings with that
205
201
  // defined by the text itself
206
202
 
207
203
  optionsCopy.displayMode = data[i].display;
@@ -229,18 +225,18 @@ var renderMathInText = function renderMathInText(text, optionsCopy) {
229
225
  return fragment;
230
226
  };
231
227
 
232
- var renderElem = function renderElem(elem, optionsCopy) {
233
- for (var i = 0; i < elem.childNodes.length; i++) {
234
- var childNode = elem.childNodes[i];
228
+ const renderElem = function (elem, optionsCopy) {
229
+ for (let i = 0; i < elem.childNodes.length; i++) {
230
+ const childNode = elem.childNodes[i];
235
231
 
236
232
  if (childNode.nodeType === 3) {
237
233
  // Text node
238
234
  // Concatenate all sibling text nodes.
239
235
  // Webkit browsers split very large text nodes into smaller ones,
240
236
  // so the delimiters may be split across different nodes.
241
- var textContentConcat = childNode.textContent;
242
- var sibling = childNode.nextSibling;
243
- var nSiblings = 0;
237
+ let textContentConcat = childNode.textContent;
238
+ let sibling = childNode.nextSibling;
239
+ let nSiblings = 0;
244
240
 
245
241
  while (sibling && sibling.nodeType === Node.TEXT_NODE) {
246
242
  textContentConcat += sibling.textContent;
@@ -248,11 +244,11 @@ var renderElem = function renderElem(elem, optionsCopy) {
248
244
  nSiblings++;
249
245
  }
250
246
 
251
- var frag = renderMathInText(textContentConcat, optionsCopy);
247
+ const frag = renderMathInText(textContentConcat, optionsCopy);
252
248
 
253
249
  if (frag) {
254
250
  // Remove extra text nodes
255
- for (var j = 0; j < nSiblings; j++) {
251
+ for (let j = 0; j < nSiblings; j++) {
256
252
  childNode.nextSibling.remove();
257
253
  }
258
254
 
@@ -264,30 +260,26 @@ var renderElem = function renderElem(elem, optionsCopy) {
264
260
  i += nSiblings;
265
261
  }
266
262
  } else if (childNode.nodeType === 1) {
267
- (function () {
268
- // Element node
269
- var className = ' ' + childNode.className + ' ';
270
- var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) {
271
- return className.indexOf(' ' + x + ' ') === -1;
272
- });
273
-
274
- if (shouldRender) {
275
- renderElem(childNode, optionsCopy);
276
- }
277
- })();
263
+ // Element node
264
+ const className = ' ' + childNode.className + ' ';
265
+ const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);
266
+
267
+ if (shouldRender) {
268
+ renderElem(childNode, optionsCopy);
269
+ }
278
270
  } // Otherwise, it's something else, and ignore it.
279
271
 
280
272
  }
281
273
  };
282
274
 
283
- var renderMathInElement = function renderMathInElement(elem, options) {
275
+ const renderMathInElement = function (elem, options) {
284
276
  if (!elem) {
285
277
  throw new Error("No element provided to render");
286
278
  }
287
279
 
288
- var optionsCopy = {}; // Object.assign(optionsCopy, option)
280
+ const optionsCopy = {}; // Object.assign(optionsCopy, option)
289
281
 
290
- for (var option in options) {
282
+ for (const option in options) {
291
283
  if (options.hasOwnProperty(option)) {
292
284
  optionsCopy[option] = options[option];
293
285
  }
@@ -1 +1 @@
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 i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.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 i={};return function(){n.d(i,{default:function(){return s}});var e=n(771),t=n.n(e),r=function(e,t,r){for(var n=r,i=0,a=e.length;n<t.length;){var o=t[n];if(i<=0&&t.slice(n,n+a)===e)return n;"\\"===o?n++:"{"===o?i++:"}"===o&&i--,n++}return-1},a=/^\\begin{/,o=function(e,t){for(var n,i=[],o=new RegExp("("+t.map((function(e){return e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")})).join("|")+")");-1!==(n=e.search(o));){n>0&&(i.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=a.test(d)?d:e.slice(t[l].left.length,n);i.push({type:"math",data:s,rawData:d,display:t[l].display}),e=e.slice(n+t[l].right.length)}return""!==e&&i.push({type:"text",data:e}),i},l=function(e,r){var n=o(e,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;for(var i=document.createDocumentFragment(),a=0;a<n.length;a++)if("text"===n[a].type)i.appendChild(document.createTextNode(n[a].data));else{var l=document.createElement("span"),d=n[a].data;r.displayMode=n[a].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[a].data+"` with ",e),i.appendChild(document.createTextNode(n[a].rawData));continue}i.appendChild(l)}return i},d=function e(t,r){for(var n=0;n<t.childNodes.length;n++){var i=t.childNodes[n];if(3===i.nodeType){for(var a=i.textContent,o=i.nextSibling,d=0;o&&o.nodeType===Node.TEXT_NODE;)a+=o.textContent,o=o.nextSibling,d++;var s=l(a,r);if(s){for(var f=0;f<d;f++)i.nextSibling.remove();n+=s.childNodes.length-1,t.replaceChild(s,i)}else n+=d}else 1===i.nodeType&&function(){var t=" "+i.className+" ";-1===r.ignoredTags.indexOf(i.nodeName.toLowerCase())&&r.ignoredClasses.every((function(e){return-1===t.indexOf(" "+e+" ")}))&&e(i,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)}}(),i=i.default}()}));
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}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};return function(){r.d(o,{default:function(){return d}});var e=r(771),t=r.n(e);const n=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},i=/^\\begin{/;var a=function(e,t){let r;const o=[],a=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;r=e.search(a),-1!==r;){r>0&&(o.push({type:"text",data:e.slice(0,r)}),e=e.slice(r));const a=t.findIndex((t=>e.startsWith(t.left)));if(r=n(t[a].right,e,t[a].left.length),-1===r)break;const l=e.slice(0,r+t[a].right.length),s=i.test(l)?l:e.slice(t[a].left.length,r);o.push({type:"math",data:s,rawData:l,display:t[a].display}),e=e.slice(r+t[a].right.length)}return""!==e&&o.push({type:"text",data:e}),o};const l=function(e,n){const r=a(e,n.delimiters);if(1===r.length&&"text"===r[0].type)return null;const o=document.createDocumentFragment();for(let e=0;e<r.length;e++)if("text"===r[e].type)o.appendChild(document.createTextNode(r[e].data));else{const i=document.createElement("span");let a=r[e].data;n.displayMode=r[e].display;try{n.preProcess&&(a=n.preProcess(a)),t().render(a,i,n)}catch(i){if(!(i instanceof t().ParseError))throw i;n.errorCallback("KaTeX auto-render: Failed to parse `"+r[e].data+"` with ",i),o.appendChild(document.createTextNode(r[e].rawData));continue}o.appendChild(i)}return o},s=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const s=l(o,t);if(s){for(let e=0;e<a;e++)r.nextSibling.remove();n+=s.childNodes.length-1,e.replaceChild(s,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&s(r,t)}}};var d=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.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}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},s(e,n)}}(),o=o.default}()}));
@@ -14,7 +14,7 @@ var __webpack_exports__ = {};
14
14
 
15
15
  ;// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
16
16
  // Set these to how you want inline and display math to be delimited.
17
- var defaultCopyDelimiters = {
17
+ const defaultCopyDelimiters = {
18
18
  inline: ['$', '$'],
19
19
  // alternative: ['\(', '\)']
20
20
  display: ['$$', '$$'] // alternative: ['\[', '\]']
@@ -30,10 +30,10 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
30
30
 
31
31
  // Remove .katex-html blocks that are preceded by .katex-mathml blocks
32
32
  // (which will get replaced below).
33
- var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
33
+ const katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
34
34
 
35
- for (var i = 0; i < katexHtml.length; i++) {
36
- var element = katexHtml[i];
35
+ for (let i = 0; i < katexHtml.length; i++) {
36
+ const element = katexHtml[i];
37
37
 
38
38
  if (element.remove) {
39
39
  element.remove();
@@ -44,18 +44,17 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
44
44
  // descendant, with inline delimiters.
45
45
 
46
46
 
47
- var katexMathml = fragment.querySelectorAll('.katex-mathml');
47
+ const katexMathml = fragment.querySelectorAll('.katex-mathml');
48
48
 
49
- for (var _i = 0; _i < katexMathml.length; _i++) {
50
- var _element = katexMathml[_i];
51
-
52
- var texSource = _element.querySelector('annotation');
49
+ for (let i = 0; i < katexMathml.length; i++) {
50
+ const element = katexMathml[i];
51
+ const texSource = element.querySelector('annotation');
53
52
 
54
53
  if (texSource) {
55
- if (_element.replaceWith) {
56
- _element.replaceWith(texSource);
57
- } else if (_element.parentNode) {
58
- _element.parentNode.replaceChild(texSource, _element);
54
+ if (element.replaceWith) {
55
+ element.replaceWith(texSource);
56
+ } else if (element.parentNode) {
57
+ element.parentNode.replaceChild(texSource, element);
59
58
  }
60
59
 
61
60
  texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
@@ -63,11 +62,11 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
63
62
  } // Switch display math to display delimiters.
64
63
 
65
64
 
66
- var displays = fragment.querySelectorAll('.katex-display annotation');
65
+ const displays = fragment.querySelectorAll('.katex-display annotation');
67
66
 
68
- for (var _i2 = 0; _i2 < displays.length; _i2++) {
69
- var _element2 = displays[_i2];
70
- _element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
67
+ for (let i = 0; i < displays.length; i++) {
68
+ const element = displays[i];
69
+ element.innerHTML = copyDelimiters.display[0] + element.innerHTML.substr(copyDelimiters.inline[0].length, element.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
71
70
  }
72
71
 
73
72
  return fragment;
@@ -79,43 +78,41 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
79
78
  function closestKatex(node) {
80
79
  // If node is a Text Node, for example, go up to containing Element,
81
80
  // where we can apply the `closest` method.
82
- var element = node instanceof Element ? node : node.parentElement;
81
+ const element = node instanceof Element ? node : node.parentElement;
83
82
  return element && element.closest('.katex');
84
83
  } // Global copy handler to modify behavior on/within .katex elements.
85
84
 
86
85
 
87
86
  document.addEventListener('copy', function (event) {
88
- var selection = window.getSelection();
87
+ const selection = window.getSelection();
89
88
 
90
89
  if (selection.isCollapsed || !event.clipboardData) {
91
90
  return; // default action OK if selection is empty or unchangeable
92
91
  }
93
92
 
94
- var clipboardData = event.clipboardData;
95
- var range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
93
+ const clipboardData = event.clipboardData;
94
+ const range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
96
95
 
97
- var startKatex = closestKatex(range.startContainer);
96
+ const startKatex = closestKatex(range.startContainer);
98
97
 
99
98
  if (startKatex) {
100
99
  range.setStartBefore(startKatex);
101
100
  } // Similarly, when end point is within a formula, expand to entire formula.
102
101
 
103
102
 
104
- var endKatex = closestKatex(range.endContainer);
103
+ const endKatex = closestKatex(range.endContainer);
105
104
 
106
105
  if (endKatex) {
107
106
  range.setEndAfter(endKatex);
108
107
  }
109
108
 
110
- var fragment = range.cloneContents();
109
+ const fragment = range.cloneContents();
111
110
 
112
111
  if (!fragment.querySelector('.katex-mathml')) {
113
112
  return; // default action OK if no .katex-mathml elements
114
113
  }
115
114
 
116
- var htmlContents = Array.prototype.map.call(fragment.childNodes, function (el) {
117
- return el instanceof Text ? el.textContent : el.outerHTML;
118
- }).join(''); // Preserve usual HTML copy/paste behavior.
115
+ const htmlContents = Array.prototype.map.call(fragment.childNodes, el => el instanceof Text ? el.textContent : el.outerHTML).join(''); // Preserve usual HTML copy/paste behavior.
119
116
 
120
117
  clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
121
118
 
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={},t={inline:["$","$"],display:["$$","$$"]};var n=function(e,n){void 0===n&&(n=t);for(var r=e.querySelectorAll(".katex-mathml + .katex-html"),a=0;a<r.length;a++){var o=r[a];o.remove?o.remove():o.parentNode&&o.parentNode.removeChild(o)}for(var i=e.querySelectorAll(".katex-mathml"),l=0;l<i.length;l++){var f=i[l],c=f.querySelector("annotation");c&&(f.replaceWith?f.replaceWith(c):f.parentNode&&f.parentNode.replaceChild(c,f),c.innerHTML=n.inline[0]+c.innerHTML+n.inline[1])}for(var d=e.querySelectorAll(".katex-display annotation"),s=0;s<d.length;s++){var p=d[s];p.innerHTML=n.display[0]+p.innerHTML.substr(n.inline[0].length,p.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};function r(e){var t=e instanceof Element?e:e.parentElement;return t&&t.closest(".katex")}return document.addEventListener("copy",(function(e){var t=window.getSelection();if(!t.isCollapsed&&e.clipboardData){var a=e.clipboardData,o=t.getRangeAt(0),i=r(o.startContainer);i&&o.setStartBefore(i);var l=r(o.endContainer);l&&o.setEndAfter(l);var f=o.cloneContents();if(f.querySelector(".katex-mathml")){var c=Array.prototype.map.call(f.childNodes,(function(e){return e instanceof Text?e.textContent:e.outerHTML})).join("");a.setData("text/html",c),a.setData("text/plain",n(f).textContent),e.preventDefault()}}})),e=e.default}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={};const t={inline:["$","$"],display:["$$","$$"]};var n=function(e,n){void 0===n&&(n=t);const o=e.querySelectorAll(".katex-mathml + .katex-html");for(let e=0;e<o.length;e++){const t=o[e];t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)}const r=e.querySelectorAll(".katex-mathml");for(let e=0;e<r.length;e++){const t=r[e],o=t.querySelector("annotation");o&&(t.replaceWith?t.replaceWith(o):t.parentNode&&t.parentNode.replaceChild(o,t),o.innerHTML=n.inline[0]+o.innerHTML+n.inline[1])}const l=e.querySelectorAll(".katex-display annotation");for(let e=0;e<l.length;e++){const t=l[e];t.innerHTML=n.display[0]+t.innerHTML.substr(n.inline[0].length,t.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};function o(e){const t=e instanceof Element?e:e.parentElement;return t&&t.closest(".katex")}return document.addEventListener("copy",(function(e){const t=window.getSelection();if(t.isCollapsed||!e.clipboardData)return;const r=e.clipboardData,l=t.getRangeAt(0),i=o(l.startContainer);i&&l.setStartBefore(i);const a=o(l.endContainer);a&&l.setEndAfter(a);const s=l.cloneContents();if(!s.querySelector(".katex-mathml"))return;const c=Array.prototype.map.call(s.childNodes,(e=>e instanceof Text?e.textContent:e.outerHTML)).join("");r.setData("text/html",c),r.setData("text/plain",n(s).textContent),e.preventDefault()})),e=e.default}()}));
@@ -82,15 +82,15 @@ var __webpack_exports__ = {};
82
82
  /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
83
83
  /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
84
84
 
85
- var scripts = document.body.getElementsByTagName("script");
85
+ let scripts = document.body.getElementsByTagName("script");
86
86
  scripts = Array.prototype.slice.call(scripts);
87
87
  scripts.forEach(function (script) {
88
88
  if (!script.type || !script.type.match(/math\/tex/i)) {
89
89
  return -1;
90
90
  }
91
91
 
92
- var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
93
- var katexElement = document.createElement(display ? "div" : "span");
92
+ const display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
93
+ const katexElement = document.createElement(display ? "div" : "span");
94
94
  katexElement.setAttribute("class", display ? "equation" : "inline-equation");
95
95
 
96
96
  try {
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var r="object"==typeof exports?t(require("katex")):t(e.katex);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.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 o,i,a,u={};return o=n(771),i=n.n(o),a=document.body.getElementsByTagName("script"),(a=Array.prototype.slice.call(a)).forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;var t=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(t?"div":"span");r.setAttribute("class",t?"equation":"inline-equation");try{i().render(e.text,r,{displayMode:t})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)})),u=u.default}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var n="object"==typeof exports?t(require("katex")):t(e.katex);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};return function(){var e=r(771),t=r.n(e);let n=document.body.getElementsByTagName("script");n=Array.prototype.slice.call(n),n.forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;const n=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(n?"div":"span");r.setAttribute("class",n?"equation":"inline-equation");try{t().render(e.text,r,{displayMode:n})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)}))}(),o=o.default}()}));