katex 0.13.17 → 0.13.21

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.
Files changed (89) hide show
  1. package/README.md +3 -3
  2. package/cli.js +3 -1
  3. package/contrib/copy-tex/README.md +3 -3
  4. package/contrib/mathtex-script-type/README.md +5 -5
  5. package/contrib/mhchem/README.md +1 -1
  6. package/dist/README.md +3 -3
  7. package/dist/contrib/auto-render.js +5 -5
  8. package/dist/contrib/auto-render.min.js +1 -1
  9. package/dist/contrib/copy-tex.js +1 -1
  10. package/dist/contrib/mathtex-script-type.js +5 -5
  11. package/dist/contrib/mathtex-script-type.min.js +1 -1
  12. package/dist/contrib/mhchem.js +5 -5
  13. package/dist/contrib/mhchem.min.js +1 -1
  14. package/dist/contrib/render-a11y-string.js +5 -5
  15. package/dist/contrib/render-a11y-string.min.js +1 -1
  16. package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
  17. package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
  18. package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  19. package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  20. package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  21. package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  22. package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  23. package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  24. package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  25. package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  26. package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  27. package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  28. package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  29. package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  30. package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  31. package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
  32. package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
  33. package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  34. package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  35. package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  36. package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  37. package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
  38. package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
  39. package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  40. package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
  41. package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
  42. package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  43. package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  44. package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  45. package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  46. package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
  47. package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
  48. package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  49. package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  50. package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  51. package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  52. package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  53. package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  54. package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  55. package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  56. package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  57. package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  58. package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
  59. package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
  60. package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  61. package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
  62. package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
  63. package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  64. package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
  65. package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
  66. package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  67. package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
  68. package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
  69. package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  70. package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
  71. package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
  72. package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  73. package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  74. package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  75. package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  76. package/dist/katex.css +1 -1
  77. package/dist/katex.js +31 -12
  78. package/dist/katex.min.css +1 -1
  79. package/dist/katex.min.js +1 -1
  80. package/dist/katex.mjs +30 -11
  81. package/package.json +5 -5
  82. package/src/buildHTML.js +6 -2
  83. package/src/environments/array.js +4 -2
  84. package/src/fonts/generate_fonts.py +3 -6
  85. package/src/functions/lap.js +3 -1
  86. package/src/symbols.js +2 -2
  87. package/CHANGELOG.md +0 -855
  88. package/src/fonts/.gitignore +0 -9
  89. package/src/metrics/.gitignore +0 -1
package/dist/katex.mjs CHANGED
@@ -4273,9 +4273,9 @@ defineSymbol(math, main, mathord, "\u03d6", "\\varpi", true);
4273
4273
  defineSymbol(math, main, mathord, "\u03f1", "\\varrho", true);
4274
4274
  defineSymbol(math, main, mathord, "\u03c2", "\\varsigma", true);
4275
4275
  defineSymbol(math, main, mathord, "\u03c6", "\\varphi", true);
4276
- defineSymbol(math, main, bin, "\u2217", "*");
4276
+ defineSymbol(math, main, bin, "\u2217", "*", true);
4277
4277
  defineSymbol(math, main, bin, "+", "+");
4278
- defineSymbol(math, main, bin, "\u2212", "-");
4278
+ defineSymbol(math, main, bin, "\u2212", "-", true);
4279
4279
  defineSymbol(math, main, bin, "\u22c5", "\\cdot", true);
4280
4280
  defineSymbol(math, main, bin, "\u2218", "\\circ");
4281
4281
  defineSymbol(math, main, bin, "\u00f7", "\\div", true);
@@ -6286,7 +6286,11 @@ function buildHTMLUnbreakable(children, options) {
6286
6286
 
6287
6287
  var strut = makeSpan$1(["strut"]);
6288
6288
  strut.style.height = body.height + body.depth + "em";
6289
- strut.style.verticalAlign = -body.depth + "em";
6289
+
6290
+ if (body.depth) {
6291
+ strut.style.verticalAlign = -body.depth + "em";
6292
+ }
6293
+
6290
6294
  body.children.unshift(strut);
6291
6295
  return body;
6292
6296
  }
@@ -6381,7 +6385,10 @@ function buildHTML(tree, options) {
6381
6385
  if (tagChild) {
6382
6386
  var strut = tagChild.children[0];
6383
6387
  strut.style.height = htmlNode.height + htmlNode.depth + "em";
6384
- strut.style.verticalAlign = -htmlNode.depth + "em";
6388
+
6389
+ if (htmlNode.depth) {
6390
+ strut.style.verticalAlign = -htmlNode.depth + "em";
6391
+ }
6385
6392
  }
6386
6393
 
6387
6394
  return htmlNode;
@@ -10038,7 +10045,8 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
10038
10045
  var nc = 0;
10039
10046
  var body = new Array(nr);
10040
10047
  var hlines = [];
10041
- var ruleThickness = Math.max(options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override.
10048
+ var ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
10049
+ options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override.
10042
10050
  ); // Horizontal spacing
10043
10051
 
10044
10052
  var pt = 1 / options.fontMetrics().ptPerEm;
@@ -10193,7 +10201,13 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
10193
10201
  separator.style.borderRightWidth = ruleThickness + "em";
10194
10202
  separator.style.borderRightStyle = lineType;
10195
10203
  separator.style.margin = "0 -" + ruleThickness / 2 + "em";
10196
- separator.style.verticalAlign = -(totalHeight - offset) + "em";
10204
+
10205
+ var _shift = totalHeight - offset;
10206
+
10207
+ if (_shift) {
10208
+ separator.style.verticalAlign = -_shift + "em";
10209
+ }
10210
+
10197
10211
  cols.push(separator);
10198
10212
  } else {
10199
10213
  throw new ParseError("Invalid separator type: " + colDescr.separator);
@@ -10230,14 +10244,14 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
10230
10244
  continue;
10231
10245
  }
10232
10246
 
10233
- var _shift = row.pos - offset;
10247
+ var _shift2 = row.pos - offset;
10234
10248
 
10235
10249
  elem.depth = row.depth;
10236
10250
  elem.height = row.height;
10237
10251
  col.push({
10238
10252
  type: "elem",
10239
10253
  elem: elem,
10240
- shift: _shift
10254
+ shift: _shift2
10241
10255
  });
10242
10256
  }
10243
10257
 
@@ -12453,7 +12467,11 @@ defineFunction({
12453
12467
 
12454
12468
  var strut = buildCommon.makeSpan(["strut"]);
12455
12469
  strut.style.height = node.height + node.depth + "em";
12456
- strut.style.verticalAlign = -node.depth + "em";
12470
+
12471
+ if (node.depth) {
12472
+ strut.style.verticalAlign = -node.depth + "em";
12473
+ }
12474
+
12457
12475
  node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
12458
12476
  // This code resolves issue #1234
12459
12477
 
@@ -17021,7 +17039,8 @@ class Parser {
17021
17039
  var argType = funcData.argTypes && funcData.argTypes[i];
17022
17040
  var isOptional = i < funcData.numOptionalArgs;
17023
17041
 
17024
- if (funcData.primitive && argType == null || funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
17042
+ if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist
17043
+ funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
17025
17044
  argType = "primitive";
17026
17045
  }
17027
17046
 
@@ -17720,7 +17739,7 @@ var katex = {
17720
17739
  /**
17721
17740
  * Current KaTeX version
17722
17741
  */
17723
- version: "0.13.17",
17742
+ version: "0.13.21",
17724
17743
 
17725
17744
  /**
17726
17745
  * Renders the given LaTeX into an HTML+MathML combination, and adds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "katex",
3
- "version": "0.13.17",
3
+ "version": "0.13.21",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "homepage": "https://katex.org",
@@ -29,8 +29,8 @@
29
29
  "@babel/runtime": "^7.10.4",
30
30
  "@rollup/plugin-alias": "^3.1.1",
31
31
  "@rollup/plugin-babel": "^5.0.4",
32
- "@semantic-release/changelog": "^5.0.1",
33
- "@semantic-release/git": "^9.0.0",
32
+ "@semantic-release/changelog": "^6.0.0",
33
+ "@semantic-release/git": "^10.0.0",
34
34
  "babel-jest": "^27.0.0",
35
35
  "babel-loader": "^8.0.5",
36
36
  "babel-plugin-istanbul": "^6.0.0",
@@ -44,7 +44,7 @@
44
44
  "cssnano": "^5.0.0-rc.1",
45
45
  "eslint": "^7.4.0",
46
46
  "eslint-plugin-actions": "^1.0.1",
47
- "eslint-plugin-flowtype": "^5.2.0",
47
+ "eslint-plugin-flowtype": "^6.0.0",
48
48
  "eslint-plugin-react": "^7.20.3",
49
49
  "flow-bin": "^0.135.0",
50
50
  "fs-extra": "^10.0.0",
@@ -75,7 +75,7 @@
75
75
  "rimraf": "^3.0.2",
76
76
  "rollup": "^2.21.0",
77
77
  "selenium-webdriver": "^4.0.0-beta.4",
78
- "semantic-release": "^17.4.1",
78
+ "semantic-release": "^18.0.0",
79
79
  "sri-toolbox": "^0.2.0",
80
80
  "style-loader": "^3.0.0",
81
81
  "stylelint": "^13.6.1",
package/src/buildHTML.js CHANGED
@@ -300,7 +300,9 @@ function buildHTMLUnbreakable(children, options) {
300
300
  // falls at the depth of the expression.
301
301
  const strut = makeSpan(["strut"]);
302
302
  strut.style.height = (body.height + body.depth) + "em";
303
- strut.style.verticalAlign = -body.depth + "em";
303
+ if (body.depth) {
304
+ strut.style.verticalAlign = -body.depth + "em";
305
+ }
304
306
  body.children.unshift(strut);
305
307
 
306
308
  return body;
@@ -394,7 +396,9 @@ export default function buildHTML(tree: AnyParseNode[], options: Options): DomSp
394
396
  if (tagChild) {
395
397
  const strut = tagChild.children[0];
396
398
  strut.style.height = (htmlNode.height + htmlNode.depth) + "em";
397
- strut.style.verticalAlign = (-htmlNode.depth) + "em";
399
+ if (htmlNode.depth) {
400
+ strut.style.verticalAlign = (-htmlNode.depth) + "em";
401
+ }
398
402
  }
399
403
 
400
404
  return htmlNode;
@@ -381,8 +381,10 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
381
381
  separator.style.borderRightWidth = `${ruleThickness}em`;
382
382
  separator.style.borderRightStyle = lineType;
383
383
  separator.style.margin = `0 -${ruleThickness / 2}em`;
384
- separator.style.verticalAlign =
385
- -(totalHeight - offset) + "em";
384
+ const shift = totalHeight - offset;
385
+ if (shift) {
386
+ separator.style.verticalAlign = -shift + "em";
387
+ }
386
388
 
387
389
  cols.push(separator);
388
390
  } else {
@@ -15,13 +15,12 @@ if len(sys.argv) < 2:
15
15
  font_file = sys.argv[1]
16
16
  font_name = os.path.splitext(os.path.basename(font_file))[0]
17
17
 
18
- # now or SOURCE_DATE_EPOCH, if present
19
- timestamp = timestampNow()
20
18
 
21
19
  font = TTFont(font_file, recalcBBoxes=False, recalcTimestamp=False)
22
20
 
23
- font['head'].created = timestamp
24
- font['head'].modified = timestamp
21
+ # fix timestamp to the epoch
22
+ font['head'].created = 0
23
+ font['head'].modified = 0
25
24
 
26
25
  # remove fontforge timestamps
27
26
  if 'FFTM' in font:
@@ -36,8 +35,6 @@ if 'GDEF' in font:
36
35
  font['name'].names = [record for record in font['name'].names if record.platformID != 1]
37
36
  font['cmap'].tables = [table for table in font['cmap'].tables if table.platformID != 1]
38
37
 
39
- font['name'].setName('Version ' + str(timestamp), 5, 3, 1, 1033)
40
-
41
38
  # fix OS/2 and hhea metrics
42
39
  glyf = font['glyf']
43
40
  ascent = int(max(glyf[c].yMax for c in font.getGlyphOrder() if hasattr(glyf[c], "yMax")))
@@ -47,7 +47,9 @@ defineFunction({
47
47
  // This code resolved issue #1153
48
48
  const strut = buildCommon.makeSpan(["strut"]);
49
49
  strut.style.height = (node.height + node.depth) + "em";
50
- strut.style.verticalAlign = -node.depth + "em";
50
+ if (node.depth) {
51
+ strut.style.verticalAlign = -node.depth + "em";
52
+ }
51
53
  node.children.unshift(strut);
52
54
 
53
55
  // Next, prevent vertical misplacement when next to something tall.
package/src/symbols.js CHANGED
@@ -534,9 +534,9 @@ defineSymbol(math, main, mathord, "\u03d6", "\\varpi", true);
534
534
  defineSymbol(math, main, mathord, "\u03f1", "\\varrho", true);
535
535
  defineSymbol(math, main, mathord, "\u03c2", "\\varsigma", true);
536
536
  defineSymbol(math, main, mathord, "\u03c6", "\\varphi", true);
537
- defineSymbol(math, main, bin, "\u2217", "*");
537
+ defineSymbol(math, main, bin, "\u2217", "*", true);
538
538
  defineSymbol(math, main, bin, "+", "+");
539
- defineSymbol(math, main, bin, "\u2212", "-");
539
+ defineSymbol(math, main, bin, "\u2212", "-", true);
540
540
  defineSymbol(math, main, bin, "\u22c5", "\\cdot", true);
541
541
  defineSymbol(math, main, bin, "\u2218", "\\circ");
542
542
  defineSymbol(math, main, bin, "\u00f7", "\\div", true);