katex 0.13.18 → 0.13.22

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 +4 -2
  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 +4 -4
  77. package/dist/katex.js +29 -10
  78. package/dist/katex.min.css +1 -1
  79. package/dist/katex.min.js +1 -1
  80. package/dist/katex.mjs +28 -9
  81. package/package.json +13 -10
  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/katex.less +3 -3
  87. package/CHANGELOG.md +0 -862
  88. package/src/fonts/.gitignore +0 -9
  89. package/src/metrics/.gitignore +0 -1
package/dist/katex.mjs CHANGED
@@ -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.18",
17742
+ version: "0.13.22",
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.18",
3
+ "version": "0.13.22",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "homepage": "https://katex.org",
@@ -21,6 +21,8 @@
21
21
  "@babel/core": "^7.10.4",
22
22
  "@babel/eslint-parser": "^7.15.0",
23
23
  "@babel/plugin-proposal-class-properties": "^7.10.4",
24
+ "@babel/plugin-syntax-flow": "^7.14.5",
25
+ "@babel/plugin-transform-react-jsx": "^7.14.9",
24
26
  "@babel/plugin-transform-runtime": "^7.10.4",
25
27
  "@babel/preset-env": "^7.10.4",
26
28
  "@babel/preset-flow": "^7.10.4",
@@ -29,8 +31,8 @@
29
31
  "@babel/runtime": "^7.10.4",
30
32
  "@rollup/plugin-alias": "^3.1.1",
31
33
  "@rollup/plugin-babel": "^5.0.4",
32
- "@semantic-release/changelog": "^5.0.1",
33
- "@semantic-release/git": "^9.0.0",
34
+ "@semantic-release/changelog": "^6.0.0",
35
+ "@semantic-release/git": "^10.0.0",
34
36
  "babel-jest": "^27.0.0",
35
37
  "babel-loader": "^8.0.5",
36
38
  "babel-plugin-istanbul": "^6.0.0",
@@ -42,9 +44,9 @@
42
44
  "caniuse-lite": "^1.0.30001102",
43
45
  "css-loader": "^6.0.0",
44
46
  "cssnano": "^5.0.0-rc.1",
45
- "eslint": "^7.4.0",
46
- "eslint-plugin-actions": "^1.0.1",
47
- "eslint-plugin-flowtype": "^5.2.0",
47
+ "eslint": "^8.0.0",
48
+ "eslint-plugin-actions": "^2.0.0",
49
+ "eslint-plugin-flowtype": "^8.0.0",
48
50
  "eslint-plugin-react": "^7.20.3",
49
51
  "flow-bin": "^0.135.0",
50
52
  "fs-extra": "^10.0.0",
@@ -68,6 +70,7 @@
68
70
  "p-retry": "^4.6.1",
69
71
  "pako": "^2.0.0",
70
72
  "postcss": "^8.0.0",
73
+ "postcss-less": "^5.0.0",
71
74
  "postcss-loader": "^6.0.0",
72
75
  "postcss-preset-env": "^6.7.0",
73
76
  "prettier": "^2.0.5",
@@ -75,11 +78,11 @@
75
78
  "rimraf": "^3.0.2",
76
79
  "rollup": "^2.21.0",
77
80
  "selenium-webdriver": "^4.0.0-beta.4",
78
- "semantic-release": "^17.4.1",
81
+ "semantic-release": "^18.0.0",
79
82
  "sri-toolbox": "^0.2.0",
80
83
  "style-loader": "^3.0.0",
81
- "stylelint": "^13.6.1",
82
- "stylelint-config-standard": "^22.0.0",
84
+ "stylelint": "^14.0.0",
85
+ "stylelint-config-standard": "^23.0.0",
83
86
  "terser-webpack-plugin": "^5.0.3",
84
87
  "webpack": "^5.51.1",
85
88
  "webpack-bundle-analyzer": "^4.0.0",
@@ -114,7 +117,7 @@
114
117
  "dist:zip": "rimraf katex/ katex.tar.gz katex.zip && cp -R dist katex && tar czf katex.tar.gz katex && zip -rq katex.zip katex && rimraf katex/"
115
118
  },
116
119
  "dependencies": {
117
- "commander": "^6.0.0"
120
+ "commander": "^8.0.0"
118
121
  },
119
122
  "husky": {
120
123
  "hooks": {
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/katex.less CHANGED
@@ -568,7 +568,7 @@
568
568
  }
569
569
 
570
570
  .boxpad {
571
- padding: 0 0.3em 0 0.3em; // \fboxsep = 3pt
571
+ padding: 0 0.3em; // \fboxsep = 3pt
572
572
  }
573
573
 
574
574
  .fbox,
@@ -578,7 +578,7 @@
578
578
  }
579
579
 
580
580
  .cancel-pad {
581
- padding: 0 0.2em 0 0.2em; // ref: cancel package \advance\dimen@ 2\p@ % "+2"
581
+ padding: 0 0.2em; // ref: cancel package \advance\dimen@ 2\p@ % "+2"
582
582
  }
583
583
 
584
584
  .cancel-lap {
@@ -600,7 +600,7 @@
600
600
  }
601
601
 
602
602
  .anglpad {
603
- padding: 0 0.03889em 0 0.03889em; // pad 1mu left and right (in scriptstyle)
603
+ padding: 0 0.03889em; // pad 1mu left and right (in scriptstyle)
604
604
  }
605
605
 
606
606
  .eqn-num::before {