katex 0.16.1 → 0.16.2

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
@@ -31,13 +31,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
31
31
  <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
32
32
  <html>
33
33
  <head>
34
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.1/dist/katex.min.css" integrity="sha384-pe7s+HmY6KvqRkrRRUr4alQJ0SkmzCft3RpK1ttGMa7qk8Abp/MEa/4wgceRHloO" crossorigin="anonymous">
34
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.css" integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">
35
35
 
36
36
  <!-- The loading of KaTeX is deferred to speed up page rendering -->
37
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.1/dist/katex.min.js" integrity="sha384-YYpuPYVAiGj+ZojhNMsgPOEZqjDxPzaUxsIHRgIda7sbl1uLOwzlHW9lGXMcorkx" crossorigin="anonymous"></script>
37
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.js" integrity="sha384-Qsn9KnoKISj6dI8g7p1HBlNpVx0I8p1SvlwOldgi3IorMle61nQy4zEahWYtljaz" crossorigin="anonymous"></script>
38
38
 
39
39
  <!-- To automatically render math in text elements, include the auto-render extension: -->
40
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
40
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
41
41
  onload="renderMathInElement(document.body);"></script>
42
42
  </head>
43
43
  ...
@@ -55,10 +55,29 @@ const renderElem = function(elem, optionsCopy) {
55
55
  const childNode = elem.childNodes[i];
56
56
  if (childNode.nodeType === 3) {
57
57
  // Text node
58
- const frag = renderMathInText(childNode.textContent, optionsCopy);
58
+ // Concatenate all sibling text nodes.
59
+ // Webkit browsers split very large text nodes into smaller ones,
60
+ // so the delimiters may be split across different nodes.
61
+ let textContentConcat = childNode.textContent;
62
+ let sibling = childNode.nextSibling;
63
+ let nSiblings = 0;
64
+ while (sibling && (sibling.nodeType === Node.TEXT_NODE)) {
65
+ textContentConcat += sibling.textContent;
66
+ sibling = sibling.nextSibling;
67
+ nSiblings++;
68
+ }
69
+ const frag = renderMathInText(textContentConcat, optionsCopy);
59
70
  if (frag) {
71
+ // Remove extra text nodes
72
+ for (let j = 0; j < nSiblings; j++) {
73
+ childNode.nextSibling.remove();
74
+ }
60
75
  i += frag.childNodes.length - 1;
61
76
  elem.replaceChild(frag, childNode);
77
+ } else {
78
+ // If the concatenated text does not contain math
79
+ // the siblings will not either
80
+ i += nSiblings;
62
81
  }
63
82
  } else if (childNode.nodeType === 1) {
64
83
  // Element node
@@ -6,15 +6,14 @@ import renderMathInElement from "../auto-render";
6
6
 
7
7
  beforeEach(function() {
8
8
  expect.extend({
9
- toSplitInto: function(actual, left, right, result) {
9
+ toSplitInto: function(actual, result, delimiters) {
10
10
  const message = {
11
11
  pass: true,
12
12
  message: () => "'" + actual + "' split correctly",
13
13
  };
14
14
 
15
15
  const split =
16
- splitAtDelimiters(actual,
17
- [{left: left, right: right, display: false}]);
16
+ splitAtDelimiters(actual, delimiters);
18
17
 
19
18
  if (split.length !== result.length) {
20
19
  message.pass = false;
@@ -60,60 +59,76 @@ beforeEach(function() {
60
59
 
61
60
  describe("A delimiter splitter", function() {
62
61
  it("doesn't split when there are no delimiters", function() {
63
- expect("hello").toSplitInto("(", ")", [{type: "text", data: "hello"}]);
62
+ expect("hello").toSplitInto(
63
+ [
64
+ {type: "text", data: "hello"},
65
+ ],
66
+ [
67
+ {left: "(", right: ")", display: false},
68
+ ]);
64
69
  });
65
70
 
66
71
  it("doesn't create a math node with only one left delimiter", function() {
67
72
  expect("hello ( world").toSplitInto(
68
- "(", ")",
69
73
  [
70
74
  {type: "text", data: "hello "},
71
75
  {type: "text", data: "( world"},
76
+ ],
77
+ [
78
+ {left: "(", right: ")", display: false},
72
79
  ]);
73
80
  });
74
81
 
75
82
  it("doesn't split when there's only a right delimiter", function() {
76
83
  expect("hello ) world").toSplitInto(
77
- "(", ")",
78
84
  [
79
85
  {type: "text", data: "hello ) world"},
86
+ ],
87
+ [
88
+ {left: "(", right: ")", display: false},
80
89
  ]);
81
90
  });
82
91
 
83
92
  it("splits when there are both delimiters", function() {
84
93
  expect("hello ( world ) boo").toSplitInto(
85
- "(", ")",
86
94
  [
87
95
  {type: "text", data: "hello "},
88
96
  {type: "math", data: " world ",
89
97
  rawData: "( world )", display: false},
90
98
  {type: "text", data: " boo"},
99
+ ],
100
+ [
101
+ {left: "(", right: ")", display: false},
91
102
  ]);
92
103
  });
93
104
 
94
105
  it("splits on multi-character delimiters", function() {
95
106
  expect("hello [[ world ]] boo").toSplitInto(
96
- "[[", "]]",
97
107
  [
98
108
  {type: "text", data: "hello "},
99
109
  {type: "math", data: " world ",
100
110
  rawData: "[[ world ]]", display: false},
101
111
  {type: "text", data: " boo"},
112
+ ],
113
+ [
114
+ {left: "[[", right: "]]", display: false},
102
115
  ]);
103
116
  expect("hello \\begin{equation} world \\end{equation} boo").toSplitInto(
104
- "\\begin{equation}", "\\end{equation}",
105
117
  [
106
118
  {type: "text", data: "hello "},
107
119
  {type: "math", data: "\\begin{equation} world \\end{equation}",
108
120
  rawData: "\\begin{equation} world \\end{equation}",
109
121
  display: false},
110
122
  {type: "text", data: " boo"},
123
+ ],
124
+ [
125
+ {left: "\\begin{equation}", right: "\\end{equation}",
126
+ display: false},
111
127
  ]);
112
128
  });
113
129
 
114
130
  it("splits mutliple times", function() {
115
131
  expect("hello ( world ) boo ( more ) stuff").toSplitInto(
116
- "(", ")",
117
132
  [
118
133
  {type: "text", data: "hello "},
119
134
  {type: "math", data: " world ",
@@ -122,44 +137,52 @@ describe("A delimiter splitter", function() {
122
137
  {type: "math", data: " more ",
123
138
  rawData: "( more )", display: false},
124
139
  {type: "text", data: " stuff"},
140
+ ],
141
+ [
142
+ {left: "(", right: ")", display: false},
125
143
  ]);
126
144
  });
127
145
 
128
146
  it("leaves the ending when there's only a left delimiter", function() {
129
147
  expect("hello ( world ) boo ( left").toSplitInto(
130
- "(", ")",
131
148
  [
132
149
  {type: "text", data: "hello "},
133
150
  {type: "math", data: " world ",
134
151
  rawData: "( world )", display: false},
135
152
  {type: "text", data: " boo "},
136
153
  {type: "text", data: "( left"},
154
+ ],
155
+ [
156
+ {left: "(", right: ")", display: false},
137
157
  ]);
138
158
  });
139
159
 
140
160
  it("doesn't split when close delimiters are in {}s", function() {
141
161
  expect("hello ( world { ) } ) boo").toSplitInto(
142
- "(", ")",
143
162
  [
144
163
  {type: "text", data: "hello "},
145
164
  {type: "math", data: " world { ) } ",
146
165
  rawData: "( world { ) } )", display: false},
147
166
  {type: "text", data: " boo"},
167
+ ],
168
+ [
169
+ {left: "(", right: ")", display: false},
148
170
  ]);
149
171
 
150
172
  expect("hello ( world { { } ) } ) boo").toSplitInto(
151
- "(", ")",
152
173
  [
153
174
  {type: "text", data: "hello "},
154
175
  {type: "math", data: " world { { } ) } ",
155
176
  rawData: "( world { { } ) } )", display: false},
156
177
  {type: "text", data: " boo"},
178
+ ],
179
+ [
180
+ {left: "(", right: ")", display: false},
157
181
  ]);
158
182
  });
159
183
 
160
184
  it("correctly processes sequences of $..$", function() {
161
185
  expect("$hello$$world$$boo$").toSplitInto(
162
- "$", "$",
163
186
  [
164
187
  {type: "math", data: "hello",
165
188
  rawData: "$hello$", display: false},
@@ -167,17 +190,22 @@ describe("A delimiter splitter", function() {
167
190
  rawData: "$world$", display: false},
168
191
  {type: "math", data: "boo",
169
192
  rawData: "$boo$", display: false},
193
+ ],
194
+ [
195
+ {left: "$", right: "$", display: false},
170
196
  ]);
171
197
  });
172
198
 
173
199
  it("doesn't split at escaped delimiters", function() {
174
200
  expect("hello ( world \\) ) boo").toSplitInto(
175
- "(", ")",
176
201
  [
177
202
  {type: "text", data: "hello "},
178
203
  {type: "math", data: " world \\) ",
179
204
  rawData: "( world \\) )", display: false},
180
205
  {type: "text", data: " boo"},
206
+ ],
207
+ [
208
+ {left: "(", right: ")", display: false},
181
209
  ]);
182
210
 
183
211
  /* TODO(emily): make this work maybe?
@@ -194,21 +222,25 @@ describe("A delimiter splitter", function() {
194
222
 
195
223
  it("splits when the right and left delimiters are the same", function() {
196
224
  expect("hello $ world $ boo").toSplitInto(
197
- "$", "$",
198
225
  [
199
226
  {type: "text", data: "hello "},
200
227
  {type: "math", data: " world ",
201
228
  rawData: "$ world $", display: false},
202
229
  {type: "text", data: " boo"},
230
+ ],
231
+ [
232
+ {left: "$", right: "$", display: false},
203
233
  ]);
204
234
  });
205
235
 
206
236
  it("ignores \\$", function() {
207
237
  expect("$x = \\$5$").toSplitInto(
208
- "$", "$",
209
238
  [
210
239
  {type: "math", data: "x = \\$5",
211
240
  rawData: "$x = \\$5$", display: false},
241
+ ],
242
+ [
243
+ {left: "$", right: "$", display: false},
212
244
  ]);
213
245
  });
214
246
 
@@ -290,3 +322,42 @@ describe("Pre-process callback", function() {
290
322
  expect(el1.innerHTML).toEqual(el2.innerHTML);
291
323
  });
292
324
  });
325
+
326
+ describe("Parse adjacent text nodes", function() {
327
+ it("parse adjacent text nodes with math", function() {
328
+ const textNodes = ['\\[',
329
+ 'x^2 + y^2 = r^2',
330
+ '\\]'];
331
+ const el = document.createElement('div');
332
+ for (let i = 0; i < textNodes.length; i++) {
333
+ const txt = document.createTextNode(textNodes[i]);
334
+ el.appendChild(txt);
335
+ }
336
+ const el2 = document.createElement('div');
337
+ const txt = document.createTextNode(textNodes.join(''));
338
+ el2.appendChild(txt);
339
+ const delimiters = [{left: "\\[", right: "\\]", display: true}];
340
+ renderMathInElement(el, {delimiters});
341
+ renderMathInElement(el2, {delimiters});
342
+ expect(el).toStrictEqual(el2);
343
+ });
344
+
345
+ it("parse adjacent text nodes without math", function() {
346
+ const textNodes = ['Lorem ipsum dolor',
347
+ 'sit amet',
348
+ 'consectetur adipiscing elit'];
349
+ const el = document.createElement('div');
350
+ for (let i = 0; i < textNodes.length; i++) {
351
+ const txt = document.createTextNode(textNodes[i]);
352
+ el.appendChild(txt);
353
+ }
354
+ const el2 = document.createElement('div');
355
+ for (let i = 0; i < textNodes.length; i++) {
356
+ const txt = document.createTextNode(textNodes[i]);
357
+ el2.appendChild(txt);
358
+ }
359
+ const delimiters = [{left: "\\[", right: "\\]", display: true}];
360
+ renderMathInElement(el, {delimiters});
361
+ expect(el).toStrictEqual(el2);
362
+ });
363
+ });
@@ -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.1/dist/contrib/copy-tex.min.js" integrity="sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A" crossorigin="anonymous"></script>
21
+ <script src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/copy-tex.min.js" integrity="sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A" 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.1/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.2/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.1/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.2/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" 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.1/dist/katex.min.css" integrity="sha384-pe7s+HmY6KvqRkrRRUr4alQJ0SkmzCft3RpK1ttGMa7qk8Abp/MEa/4wgceRHloO" crossorigin="anonymous">
27
- <script src="https://cdn.jsdelivr.net/npm/katex@0.16.1/dist/katex.min.js" integrity="sha384-YYpuPYVAiGj+ZojhNMsgPOEZqjDxPzaUxsIHRgIda7sbl1uLOwzlHW9lGXMcorkx" crossorigin="anonymous"></script>
28
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.1/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.2/dist/katex.min.css" integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">
27
+ <script src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.js" integrity="sha384-Qsn9KnoKISj6dI8g7p1HBlNpVx0I8p1SvlwOldgi3IorMle61nQy4zEahWYtljaz" crossorigin="anonymous"></script>
28
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" 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.1/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.2/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.1/dist/contrib/mhchem.min.js" integrity="sha384-RTN08a0AXIioPBcVosEqPUfKK+rPp+h1x/izR7xMkdMyuwkcZCWdxO+RSwIFtJXN" crossorigin="anonymous"></script>
10
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/mhchem.min.js" integrity="sha384-RTN08a0AXIioPBcVosEqPUfKK+rPp+h1x/izR7xMkdMyuwkcZCWdxO+RSwIFtJXN" 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.
@@ -392,6 +392,11 @@ const handleObject = (
392
392
  break;
393
393
  }
394
394
 
395
+ case "pmb": {
396
+ a11yStrings.push("bold");
397
+ break;
398
+ }
399
+
395
400
  case "phantom": {
396
401
  a11yStrings.push("empty space");
397
402
  break;
package/dist/README.md CHANGED
@@ -31,13 +31,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
31
31
  <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
32
32
  <html>
33
33
  <head>
34
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.1/dist/katex.min.css" integrity="sha384-pe7s+HmY6KvqRkrRRUr4alQJ0SkmzCft3RpK1ttGMa7qk8Abp/MEa/4wgceRHloO" crossorigin="anonymous">
34
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.css" integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">
35
35
 
36
36
  <!-- The loading of KaTeX is deferred to speed up page rendering -->
37
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.1/dist/katex.min.js" integrity="sha384-YYpuPYVAiGj+ZojhNMsgPOEZqjDxPzaUxsIHRgIda7sbl1uLOwzlHW9lGXMcorkx" crossorigin="anonymous"></script>
37
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.js" integrity="sha384-Qsn9KnoKISj6dI8g7p1HBlNpVx0I8p1SvlwOldgi3IorMle61nQy4zEahWYtljaz" crossorigin="anonymous"></script>
38
38
 
39
39
  <!-- To automatically render math in text elements, include the auto-render extension: -->
40
- <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
40
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
41
41
  onload="renderMathInElement(document.body);"></script>
42
42
  </head>
43
43
  ...
@@ -235,11 +235,33 @@ var renderElem = function renderElem(elem, optionsCopy) {
235
235
 
236
236
  if (childNode.nodeType === 3) {
237
237
  // Text node
238
- var frag = renderMathInText(childNode.textContent, optionsCopy);
238
+ // Concatenate all sibling text nodes.
239
+ // Webkit browsers split very large text nodes into smaller ones,
240
+ // so the delimiters may be split across different nodes.
241
+ var textContentConcat = childNode.textContent;
242
+ var sibling = childNode.nextSibling;
243
+ var nSiblings = 0;
244
+
245
+ while (sibling && sibling.nodeType === Node.TEXT_NODE) {
246
+ textContentConcat += sibling.textContent;
247
+ sibling = sibling.nextSibling;
248
+ nSiblings++;
249
+ }
250
+
251
+ var frag = renderMathInText(textContentConcat, optionsCopy);
239
252
 
240
253
  if (frag) {
254
+ // Remove extra text nodes
255
+ for (var j = 0; j < nSiblings; j++) {
256
+ childNode.nextSibling.remove();
257
+ }
258
+
241
259
  i += frag.childNodes.length - 1;
242
260
  elem.replaceChild(frag, childNode);
261
+ } else {
262
+ // If the concatenated text does not contain math
263
+ // the siblings will not either
264
+ i += nSiblings;
243
265
  }
244
266
  } else if (childNode.nodeType === 1) {
245
267
  (function () {
@@ -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 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}()}));
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}()}));
@@ -138,11 +138,33 @@ var renderElem = function renderElem(elem, optionsCopy) {
138
138
 
139
139
  if (childNode.nodeType === 3) {
140
140
  // Text node
141
- var frag = renderMathInText(childNode.textContent, optionsCopy);
141
+ // Concatenate all sibling text nodes.
142
+ // Webkit browsers split very large text nodes into smaller ones,
143
+ // so the delimiters may be split across different nodes.
144
+ var textContentConcat = childNode.textContent;
145
+ var sibling = childNode.nextSibling;
146
+ var nSiblings = 0;
147
+
148
+ while (sibling && sibling.nodeType === Node.TEXT_NODE) {
149
+ textContentConcat += sibling.textContent;
150
+ sibling = sibling.nextSibling;
151
+ nSiblings++;
152
+ }
153
+
154
+ var frag = renderMathInText(textContentConcat, optionsCopy);
142
155
 
143
156
  if (frag) {
157
+ // Remove extra text nodes
158
+ for (var j = 0; j < nSiblings; j++) {
159
+ childNode.nextSibling.remove();
160
+ }
161
+
144
162
  i += frag.childNodes.length - 1;
145
163
  elem.replaceChild(frag, childNode);
164
+ } else {
165
+ // If the concatenated text does not contain math
166
+ // the siblings will not either
167
+ i += nSiblings;
146
168
  }
147
169
  } else if (childNode.nodeType === 1) {
148
170
  (function () {
@@ -481,6 +481,12 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
481
481
  break;
482
482
  }
483
483
 
484
+ case "pmb":
485
+ {
486
+ a11yStrings.push("bold");
487
+ break;
488
+ }
489
+
484
490
  case "phantom":
485
491
  {
486
492
  a11yStrings.push("empty space");
@@ -1 +1 @@
1
- !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],r);else{var a="object"==typeof exports?r(require("katex")):r(e.katex);for(var t in a)("object"==typeof exports?exports:e)[t]=a[t]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var r={771:function(r){r.exports=e}},a={};function t(e){var o=a[e];if(void 0!==o)return o.exports;var n=a[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},t.d=function(e,r){for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};var o,n,s,i,l,c,u,p,d,b,h,m,f,y,w={};return o=t(771),n=t.n(o),s={"(":"left parenthesis",")":"right parenthesis","[":"open bracket","]":"close bracket","\\{":"left brace","\\}":"right brace","\\lvert":"open vertical bar","\\rvert":"close vertical bar","|":"vertical bar","\\uparrow":"up arrow","\\Uparrow":"up arrow","\\downarrow":"down arrow","\\Downarrow":"down arrow","\\updownarrow":"up down arrow","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow","\\langle":"open angle","\\rangle":"close angle","\\lfloor":"open floor","\\rfloor":"close floor","\\int":"integral","\\intop":"integral","\\lim":"limit","\\ln":"natural log","\\log":"log","\\sin":"sine","\\cos":"cosine","\\tan":"tangent","\\cot":"cotangent","\\sum":"sum","/":"slash",",":"comma",".":"point","-":"negative","+":"plus","~":"tilde",":":"colon","?":"question mark","'":"apostrophe","\\%":"percent"," ":"space","\\ ":"space","\\$":"dollar sign","\\angle":"angle","\\degree":"degree","\\circ":"circle","\\vec":"vector","\\triangle":"triangle","\\pi":"pi","\\prime":"prime","\\infty":"infinity","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\omega":"omega","\\theta":"theta","\\sigma":"sigma","\\lambda":"lambda","\\tau":"tau","\\Delta":"delta","\\delta":"delta","\\mu":"mu","\\rho":"rho","\\nabla":"del","\\ell":"ell","\\ldots":"dots","\\hat":"hat","\\acute":"acute"},i={prime:"prime",degree:"degrees",circle:"degrees",2:"squared",3:"cubed"},l={"|":"open vertical bar",".":""},c={"|":"close vertical bar",".":""},u={"+":"plus","-":"minus","\\pm":"plus minus","\\cdot":"dot","*":"times","/":"divided by","\\times":"times","\\div":"divided by","\\circ":"circle","\\bullet":"bullet"},p={"=":"equals","\\approx":"approximately equals","\u2260":"does not equal","\\geq":"is greater than or equal to","\\ge":"is greater than or equal to","\\leq":"is less than or equal to","\\le":"is less than or equal to",">":"is greater than","<":"is less than","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow",":":"colon"},d={"\\underleftarrow":"left arrow","\\underrightarrow":"right arrow","\\underleftrightarrow":"left-right arrow","\\undergroup":"group","\\underlinesegment":"line segment","\\utilde":"tilde"},b=function(e,r,a){var t;e&&(/^\d+$/.test(t="open"===r?e in l?l[e]:s[e]||e:"close"===r?e in c?c[e]:s[e]||e:"bin"===r?u[e]||e:"rel"===r?p[e]||e:s[e]||e)&&a.length>0&&/^\d+$/.test(a[a.length-1])?a[a.length-1]+=t:t&&a.push(t))},h=function(e,r){var a=[];e.push(a),r(a)},m=function(e,r,a){switch(e.type){case"accent":h(r,(function(r){f(e.base,r,a),r.push("with"),b(e.label,"normal",r),r.push("on top")}));break;case"accentUnder":h(r,(function(r){f(e.base,r,a),r.push("with"),b(d[e.label],"normal",r),r.push("underneath")}));break;case"accent-token":break;case"atom":var t=e.text;switch(e.family){case"bin":b(t,"bin",r);break;case"close":b(t,"close",r);break;case"inner":b(e.text,"inner",r);break;case"open":b(t,"open",r);break;case"punct":b(t,"punct",r);break;case"rel":b(t,"rel",r);break;default:throw e.family,new Error('"'+e.family+'" is not a valid atom type')}break;case"color":var o=e.color.replace(/katex-/,"");h(r,(function(r){r.push("start color "+o),f(e.body,r,a),r.push("end color "+o)}));break;case"color-token":break;case"delimsizing":e.delim&&"."!==e.delim&&b(e.delim,"normal",r);break;case"genfrac":h(r,(function(r){var t=e.leftDelim,o=e.rightDelim;e.hasBarLine?(r.push("start fraction"),t&&b(t,"open",r),f(e.numer,r,a),r.push("divided by"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end fraction")):(r.push("start binomial"),t&&b(t,"open",r),f(e.numer,r,a),r.push("over"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end binomial"))}));break;case"hbox":f(e.body,r,a);break;case"kern":break;case"leftright":h(r,(function(r){b(e.left,"open",r),f(e.body,r,a),b(e.right,"close",r)}));break;case"leftright-right":break;case"lap":f(e.body,r,a);break;case"mathord":b(e.text,"normal",r);break;case"op":var n=e.body,s=e.name;n?f(n,r,a):s&&b(s,"normal",r);break;case"op-token":b(e.text,a,r);break;case"ordgroup":f(e.body,r,a);break;case"overline":h(r,(function(r){r.push("start overline"),f(e.body,r,a),r.push("end overline")}));break;case"phantom":r.push("empty space");break;case"raisebox":f(e.body,r,a);break;case"rule":r.push("rectangle");break;case"sizing":f(e.body,r,a);break;case"spacing":r.push("space");break;case"styling":f(e.body,r,a);break;case"sqrt":h(r,(function(r){var t=e.body,o=e.index;if(o)return"3"===y(f(o,[],a)).join(",")?(r.push("cube root of"),f(t,r,a),void r.push("end cube root")):(r.push("root"),r.push("start index"),f(o,r,a),void r.push("end index"));r.push("square root of"),f(t,r,a),r.push("end square root")}));break;case"supsub":var l=e.base,c=e.sub,u=e.sup,p=!1;if(l&&(f(l,r,a),p="op"===l.type&&"\\log"===l.name),c){var m=p?"base":"subscript";h(r,(function(e){e.push("start "+m),f(c,e,a),e.push("end "+m)}))}u&&h(r,(function(e){var r=y(f(u,[],a)).join(",");r in i?e.push(i[r]):(e.push("start superscript"),f(u,e,a),e.push("end superscript"))}));break;case"text":if("\\textbf"===e.font){h(r,(function(r){r.push("start bold text"),f(e.body,r,a),r.push("end bold text")}));break}h(r,(function(r){r.push("start text"),f(e.body,r,a),r.push("end text")}));break;case"textord":b(e.text,a,r);break;case"smash":f(e.body,r,a);break;case"enclose":if(/cancel/.test(e.label)){h(r,(function(r){r.push("start cancel"),f(e.body,r,a),r.push("end cancel")}));break}if(/box/.test(e.label)){h(r,(function(r){r.push("start box"),f(e.body,r,a),r.push("end box")}));break}if(/sout/.test(e.label)){h(r,(function(r){r.push("start strikeout"),f(e.body,r,a),r.push("end strikeout")}));break}if(/phase/.test(e.label)){h(r,(function(r){r.push("start phase angle"),f(e.body,r,a),r.push("end phase angle")}));break}throw new Error("KaTeX-a11y: enclose node with "+e.label+" not supported yet");case"vcenter":f(e.body,r,a);break;case"vphantom":throw new Error("KaTeX-a11y: vphantom not implemented yet");case"hphantom":throw new Error("KaTeX-a11y: hphantom not implemented yet");case"operatorname":f(e.body,r,a);break;case"array":throw new Error("KaTeX-a11y: array not implemented yet");case"raw":throw new Error("KaTeX-a11y: raw not implemented yet");case"size":break;case"url":throw new Error("KaTeX-a11y: url not implemented yet");case"tag":throw new Error("KaTeX-a11y: tag not implemented yet");case"verb":b("start verbatim","normal",r),b(e.body,"normal",r),b("end verbatim","normal",r);break;case"environment":throw new Error("KaTeX-a11y: environment not implemented yet");case"horizBrace":b("start "+e.label.slice(1),"normal",r),f(e.base,r,a),b("end "+e.label.slice(1),"normal",r);break;case"infix":break;case"includegraphics":throw new Error("KaTeX-a11y: includegraphics not implemented yet");case"font":f(e.body,r,a);break;case"href":throw new Error("KaTeX-a11y: href not implemented yet");case"cr":throw new Error("KaTeX-a11y: cr not implemented yet");case"underline":h(r,(function(r){r.push("start underline"),f(e.body,r,a),r.push("end underline")}));break;case"xArrow":throw new Error("KaTeX-a11y: xArrow not implemented yet");case"cdlabel":throw new Error("KaTeX-a11y: cdlabel not implemented yet");case"cdlabelparent":throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");case"mclass":var w=e.mclass.slice(1);f(e.body,r,w);break;case"mathchoice":f(e.text,r,a);break;case"htmlmathml":f(e.mathml,r,a);break;case"middle":b(e.delim,a,r);break;case"internal":break;case"html":f(e.body,r,a);break;default:throw e.type,new Error("KaTeX a11y un-recognized type: "+e.type)}},f=function e(r,a,t){if(void 0===a&&(a=[]),r instanceof Array)for(var o=0;o<r.length;o++)e(r[o],a,t);else m(r,a,t);return a},y=function e(r){var a=[];return r.forEach((function(r){r instanceof Array?a=a.concat(e(r)):a.push(r)})),a},w.default=function(e,r){var a=n().__parse(e,r),t=f(a,[],"normal");return y(t).join(", ")},w=w.default}()}));
1
+ !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],r);else{var a="object"==typeof exports?r(require("katex")):r(e.katex);for(var t in a)("object"==typeof exports?exports:e)[t]=a[t]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var r={771:function(r){r.exports=e}},a={};function t(e){var o=a[e];if(void 0!==o)return o.exports;var n=a[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},t.d=function(e,r){for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};var o,n,s,i,l,c,u,p,d,b,h,m,f,y,w={};return o=t(771),n=t.n(o),s={"(":"left parenthesis",")":"right parenthesis","[":"open bracket","]":"close bracket","\\{":"left brace","\\}":"right brace","\\lvert":"open vertical bar","\\rvert":"close vertical bar","|":"vertical bar","\\uparrow":"up arrow","\\Uparrow":"up arrow","\\downarrow":"down arrow","\\Downarrow":"down arrow","\\updownarrow":"up down arrow","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow","\\langle":"open angle","\\rangle":"close angle","\\lfloor":"open floor","\\rfloor":"close floor","\\int":"integral","\\intop":"integral","\\lim":"limit","\\ln":"natural log","\\log":"log","\\sin":"sine","\\cos":"cosine","\\tan":"tangent","\\cot":"cotangent","\\sum":"sum","/":"slash",",":"comma",".":"point","-":"negative","+":"plus","~":"tilde",":":"colon","?":"question mark","'":"apostrophe","\\%":"percent"," ":"space","\\ ":"space","\\$":"dollar sign","\\angle":"angle","\\degree":"degree","\\circ":"circle","\\vec":"vector","\\triangle":"triangle","\\pi":"pi","\\prime":"prime","\\infty":"infinity","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\omega":"omega","\\theta":"theta","\\sigma":"sigma","\\lambda":"lambda","\\tau":"tau","\\Delta":"delta","\\delta":"delta","\\mu":"mu","\\rho":"rho","\\nabla":"del","\\ell":"ell","\\ldots":"dots","\\hat":"hat","\\acute":"acute"},i={prime:"prime",degree:"degrees",circle:"degrees",2:"squared",3:"cubed"},l={"|":"open vertical bar",".":""},c={"|":"close vertical bar",".":""},u={"+":"plus","-":"minus","\\pm":"plus minus","\\cdot":"dot","*":"times","/":"divided by","\\times":"times","\\div":"divided by","\\circ":"circle","\\bullet":"bullet"},p={"=":"equals","\\approx":"approximately equals","\u2260":"does not equal","\\geq":"is greater than or equal to","\\ge":"is greater than or equal to","\\leq":"is less than or equal to","\\le":"is less than or equal to",">":"is greater than","<":"is less than","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow",":":"colon"},d={"\\underleftarrow":"left arrow","\\underrightarrow":"right arrow","\\underleftrightarrow":"left-right arrow","\\undergroup":"group","\\underlinesegment":"line segment","\\utilde":"tilde"},b=function(e,r,a){var t;e&&(/^\d+$/.test(t="open"===r?e in l?l[e]:s[e]||e:"close"===r?e in c?c[e]:s[e]||e:"bin"===r?u[e]||e:"rel"===r?p[e]||e:s[e]||e)&&a.length>0&&/^\d+$/.test(a[a.length-1])?a[a.length-1]+=t:t&&a.push(t))},h=function(e,r){var a=[];e.push(a),r(a)},m=function(e,r,a){switch(e.type){case"accent":h(r,(function(r){f(e.base,r,a),r.push("with"),b(e.label,"normal",r),r.push("on top")}));break;case"accentUnder":h(r,(function(r){f(e.base,r,a),r.push("with"),b(d[e.label],"normal",r),r.push("underneath")}));break;case"accent-token":break;case"atom":var t=e.text;switch(e.family){case"bin":b(t,"bin",r);break;case"close":b(t,"close",r);break;case"inner":b(e.text,"inner",r);break;case"open":b(t,"open",r);break;case"punct":b(t,"punct",r);break;case"rel":b(t,"rel",r);break;default:throw e.family,new Error('"'+e.family+'" is not a valid atom type')}break;case"color":var o=e.color.replace(/katex-/,"");h(r,(function(r){r.push("start color "+o),f(e.body,r,a),r.push("end color "+o)}));break;case"color-token":break;case"delimsizing":e.delim&&"."!==e.delim&&b(e.delim,"normal",r);break;case"genfrac":h(r,(function(r){var t=e.leftDelim,o=e.rightDelim;e.hasBarLine?(r.push("start fraction"),t&&b(t,"open",r),f(e.numer,r,a),r.push("divided by"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end fraction")):(r.push("start binomial"),t&&b(t,"open",r),f(e.numer,r,a),r.push("over"),f(e.denom,r,a),o&&b(o,"close",r),r.push("end binomial"))}));break;case"hbox":f(e.body,r,a);break;case"kern":break;case"leftright":h(r,(function(r){b(e.left,"open",r),f(e.body,r,a),b(e.right,"close",r)}));break;case"leftright-right":break;case"lap":f(e.body,r,a);break;case"mathord":b(e.text,"normal",r);break;case"op":var n=e.body,s=e.name;n?f(n,r,a):s&&b(s,"normal",r);break;case"op-token":b(e.text,a,r);break;case"ordgroup":f(e.body,r,a);break;case"overline":h(r,(function(r){r.push("start overline"),f(e.body,r,a),r.push("end overline")}));break;case"pmb":r.push("bold");break;case"phantom":r.push("empty space");break;case"raisebox":f(e.body,r,a);break;case"rule":r.push("rectangle");break;case"sizing":f(e.body,r,a);break;case"spacing":r.push("space");break;case"styling":f(e.body,r,a);break;case"sqrt":h(r,(function(r){var t=e.body,o=e.index;if(o)return"3"===y(f(o,[],a)).join(",")?(r.push("cube root of"),f(t,r,a),void r.push("end cube root")):(r.push("root"),r.push("start index"),f(o,r,a),void r.push("end index"));r.push("square root of"),f(t,r,a),r.push("end square root")}));break;case"supsub":var l=e.base,c=e.sub,u=e.sup,p=!1;if(l&&(f(l,r,a),p="op"===l.type&&"\\log"===l.name),c){var m=p?"base":"subscript";h(r,(function(e){e.push("start "+m),f(c,e,a),e.push("end "+m)}))}u&&h(r,(function(e){var r=y(f(u,[],a)).join(",");r in i?e.push(i[r]):(e.push("start superscript"),f(u,e,a),e.push("end superscript"))}));break;case"text":if("\\textbf"===e.font){h(r,(function(r){r.push("start bold text"),f(e.body,r,a),r.push("end bold text")}));break}h(r,(function(r){r.push("start text"),f(e.body,r,a),r.push("end text")}));break;case"textord":b(e.text,a,r);break;case"smash":f(e.body,r,a);break;case"enclose":if(/cancel/.test(e.label)){h(r,(function(r){r.push("start cancel"),f(e.body,r,a),r.push("end cancel")}));break}if(/box/.test(e.label)){h(r,(function(r){r.push("start box"),f(e.body,r,a),r.push("end box")}));break}if(/sout/.test(e.label)){h(r,(function(r){r.push("start strikeout"),f(e.body,r,a),r.push("end strikeout")}));break}if(/phase/.test(e.label)){h(r,(function(r){r.push("start phase angle"),f(e.body,r,a),r.push("end phase angle")}));break}throw new Error("KaTeX-a11y: enclose node with "+e.label+" not supported yet");case"vcenter":f(e.body,r,a);break;case"vphantom":throw new Error("KaTeX-a11y: vphantom not implemented yet");case"hphantom":throw new Error("KaTeX-a11y: hphantom not implemented yet");case"operatorname":f(e.body,r,a);break;case"array":throw new Error("KaTeX-a11y: array not implemented yet");case"raw":throw new Error("KaTeX-a11y: raw not implemented yet");case"size":break;case"url":throw new Error("KaTeX-a11y: url not implemented yet");case"tag":throw new Error("KaTeX-a11y: tag not implemented yet");case"verb":b("start verbatim","normal",r),b(e.body,"normal",r),b("end verbatim","normal",r);break;case"environment":throw new Error("KaTeX-a11y: environment not implemented yet");case"horizBrace":b("start "+e.label.slice(1),"normal",r),f(e.base,r,a),b("end "+e.label.slice(1),"normal",r);break;case"infix":break;case"includegraphics":throw new Error("KaTeX-a11y: includegraphics not implemented yet");case"font":f(e.body,r,a);break;case"href":throw new Error("KaTeX-a11y: href not implemented yet");case"cr":throw new Error("KaTeX-a11y: cr not implemented yet");case"underline":h(r,(function(r){r.push("start underline"),f(e.body,r,a),r.push("end underline")}));break;case"xArrow":throw new Error("KaTeX-a11y: xArrow not implemented yet");case"cdlabel":throw new Error("KaTeX-a11y: cdlabel not implemented yet");case"cdlabelparent":throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");case"mclass":var w=e.mclass.slice(1);f(e.body,r,w);break;case"mathchoice":f(e.text,r,a);break;case"htmlmathml":f(e.mathml,r,a);break;case"middle":b(e.delim,a,r);break;case"internal":break;case"html":f(e.body,r,a);break;default:throw e.type,new Error("KaTeX a11y un-recognized type: "+e.type)}},f=function e(r,a,t){if(void 0===a&&(a=[]),r instanceof Array)for(var o=0;o<r.length;o++)e(r[o],a,t);else m(r,a,t);return a},y=function e(r){var a=[];return r.forEach((function(r){r instanceof Array?a=a.concat(e(r)):a.push(r)})),a},w.default=function(e,r){var a=n().__parse(e,r),t=f(a,[],"normal");return y(t).join(", ")},w=w.default}()}));
@@ -402,6 +402,12 @@ var handleObject = (tree, a11yStrings, atomType) => {
402
402
  break;
403
403
  }
404
404
 
405
+ case "pmb":
406
+ {
407
+ a11yStrings.push("bold");
408
+ break;
409
+ }
410
+
405
411
  case "phantom":
406
412
  {
407
413
  a11yStrings.push("empty space");
package/dist/katex.css CHANGED
@@ -130,7 +130,7 @@
130
130
  border-color: currentColor;
131
131
  }
132
132
  .katex .katex-version::after {
133
- content: "0.16.1";
133
+ content: "0.16.2";
134
134
  }
135
135
  .katex .katex-mathml {
136
136
  /* Accessibility hack to only show to screen readers