katex 0.13.19 → 0.13.23

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 (80) hide show
  1. package/README.md +3 -3
  2. package/cli.js +1 -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/fonts/KaTeX_AMS-Regular.ttf +0 -0
  8. package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
  9. package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  10. package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  11. package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  12. package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  13. package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  14. package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  15. package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  16. package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  17. package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  18. package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  19. package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  20. package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  21. package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  22. package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
  23. package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
  24. package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  25. package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  26. package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  27. package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  28. package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
  29. package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
  30. package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  31. package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
  32. package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
  33. package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  34. package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  35. package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  36. package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  37. package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
  38. package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
  39. package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  40. package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  41. package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  42. package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  43. package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  44. package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  45. package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  46. package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  47. package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  48. package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  49. package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
  50. package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
  51. package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  52. package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
  53. package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
  54. package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  55. package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
  56. package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
  57. package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  58. package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
  59. package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
  60. package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  61. package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
  62. package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
  63. package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  64. package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  65. package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  66. package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  67. package/dist/katex.css +4 -4
  68. package/dist/katex.js +26 -8
  69. package/dist/katex.min.css +1 -1
  70. package/dist/katex.min.js +1 -1
  71. package/dist/katex.mjs +26 -8
  72. package/package.json +10 -7
  73. package/src/buildHTML.js +6 -2
  74. package/src/environments/array.js +4 -2
  75. package/src/fontMetricsData.js +2 -1
  76. package/src/fonts/generate_fonts.py +3 -6
  77. package/src/fonts/makeFF +2 -0
  78. package/src/functions/lap.js +3 -1
  79. package/src/katex.less +3 -3
  80. package/src/metrics/extract_ttfs.py +3 -0
package/dist/katex.mjs CHANGED
@@ -2002,6 +2002,7 @@ var fontMetricsData = {
2002
2002
  "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
2003
2003
  "8768": [0.19444, 0.69444, 0, 0, 0.31944],
2004
2004
  "8771": [0.00222, 0.50222, 0, 0, 0.89444],
2005
+ "8773": [0.027, 0.638, 0, 0, 0.894],
2005
2006
  "8776": [0.02444, 0.52444, 0, 0, 0.89444],
2006
2007
  "8781": [0.00222, 0.50222, 0, 0, 0.89444],
2007
2008
  "8801": [0.00222, 0.50222, 0, 0, 0.89444],
@@ -2519,7 +2520,7 @@ var fontMetricsData = {
2519
2520
  "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
2520
2521
  "8768": [0.19444, 0.69444, 0, 0, 0.27778],
2521
2522
  "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
2522
- "8773": [-0.022, 0.589, 0, 0, 1.0],
2523
+ "8773": [-0.022, 0.589, 0, 0, 0.778],
2523
2524
  "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
2524
2525
  "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
2525
2526
  "8784": [-0.133, 0.673, 0, 0, 0.778],
@@ -6286,7 +6287,11 @@ function buildHTMLUnbreakable(children, options) {
6286
6287
 
6287
6288
  var strut = makeSpan$1(["strut"]);
6288
6289
  strut.style.height = body.height + body.depth + "em";
6289
- strut.style.verticalAlign = -body.depth + "em";
6290
+
6291
+ if (body.depth) {
6292
+ strut.style.verticalAlign = -body.depth + "em";
6293
+ }
6294
+
6290
6295
  body.children.unshift(strut);
6291
6296
  return body;
6292
6297
  }
@@ -6381,7 +6386,10 @@ function buildHTML(tree, options) {
6381
6386
  if (tagChild) {
6382
6387
  var strut = tagChild.children[0];
6383
6388
  strut.style.height = htmlNode.height + htmlNode.depth + "em";
6384
- strut.style.verticalAlign = -htmlNode.depth + "em";
6389
+
6390
+ if (htmlNode.depth) {
6391
+ strut.style.verticalAlign = -htmlNode.depth + "em";
6392
+ }
6385
6393
  }
6386
6394
 
6387
6395
  return htmlNode;
@@ -10194,7 +10202,13 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
10194
10202
  separator.style.borderRightWidth = ruleThickness + "em";
10195
10203
  separator.style.borderRightStyle = lineType;
10196
10204
  separator.style.margin = "0 -" + ruleThickness / 2 + "em";
10197
- separator.style.verticalAlign = -(totalHeight - offset) + "em";
10205
+
10206
+ var _shift = totalHeight - offset;
10207
+
10208
+ if (_shift) {
10209
+ separator.style.verticalAlign = -_shift + "em";
10210
+ }
10211
+
10198
10212
  cols.push(separator);
10199
10213
  } else {
10200
10214
  throw new ParseError("Invalid separator type: " + colDescr.separator);
@@ -10231,14 +10245,14 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
10231
10245
  continue;
10232
10246
  }
10233
10247
 
10234
- var _shift = row.pos - offset;
10248
+ var _shift2 = row.pos - offset;
10235
10249
 
10236
10250
  elem.depth = row.depth;
10237
10251
  elem.height = row.height;
10238
10252
  col.push({
10239
10253
  type: "elem",
10240
10254
  elem: elem,
10241
- shift: _shift
10255
+ shift: _shift2
10242
10256
  });
10243
10257
  }
10244
10258
 
@@ -12454,7 +12468,11 @@ defineFunction({
12454
12468
 
12455
12469
  var strut = buildCommon.makeSpan(["strut"]);
12456
12470
  strut.style.height = node.height + node.depth + "em";
12457
- strut.style.verticalAlign = -node.depth + "em";
12471
+
12472
+ if (node.depth) {
12473
+ strut.style.verticalAlign = -node.depth + "em";
12474
+ }
12475
+
12458
12476
  node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
12459
12477
  // This code resolves issue #1234
12460
12478
 
@@ -17722,7 +17740,7 @@ var katex = {
17722
17740
  /**
17723
17741
  * Current KaTeX version
17724
17742
  */
17725
- version: "0.13.19",
17743
+ version: "0.13.23",
17726
17744
 
17727
17745
  /**
17728
17746
  * 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.19",
3
+ "version": "0.13.23",
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",
@@ -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": "^6.0.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",
@@ -78,8 +81,8 @@
78
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 {
@@ -582,6 +582,7 @@ export default {
582
582
  "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
583
583
  "8768": [0.19444, 0.69444, 0, 0, 0.31944],
584
584
  "8771": [0.00222, 0.50222, 0, 0, 0.89444],
585
+ "8773": [0.027, 0.638, 0, 0, 0.894],
585
586
  "8776": [0.02444, 0.52444, 0, 0, 0.89444],
586
587
  "8781": [0.00222, 0.50222, 0, 0, 0.89444],
587
588
  "8801": [0.00222, 0.50222, 0, 0, 0.89444],
@@ -1099,7 +1100,7 @@ export default {
1099
1100
  "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
1100
1101
  "8768": [0.19444, 0.69444, 0, 0, 0.27778],
1101
1102
  "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
1102
- "8773": [-0.022, 0.589, 0, 0, 1.0],
1103
+ "8773": [-0.022, 0.589, 0, 0, 0.778],
1103
1104
  "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
1104
1105
  "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
1105
1106
  "8784": [-0.133, 0.673, 0, 0, 0.778],
@@ -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")))
package/src/fonts/makeFF CHANGED
@@ -1311,6 +1311,7 @@ $extra{'Main-Regular'} = {
1311
1311
  'Select(0u3D)','Copy()',
1312
1312
  'Select(0u2245)',
1313
1313
  'PasteWithOffset(0,-111)',
1314
+ 'SetWidth(778)',
1314
1315
  ],
1315
1316
 
1316
1317
  bowtie => [
@@ -1607,6 +1608,7 @@ $extra{'Main-Bold'} = {
1607
1608
  'Select(0u3D)','Copy()',
1608
1609
  'Select(0u2245)',
1609
1610
  'PasteWithOffset(0,-136)',
1611
+ 'SetWidth(894)',
1610
1612
  ],
1611
1613
 
1612
1614
  bowtie => [
@@ -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 {
@@ -44,6 +44,9 @@ metrics_to_extract = {
44
44
  u"\u21aa": None, # \hookrightarrow
45
45
  u"\u21cc": None, # \rightleftharpoons
46
46
  },
47
+ "Main-Bold": {
48
+ u"\u2245": None, # \cong
49
+ },
47
50
  "Size1-Regular": {
48
51
  u"\u222c": u"\u222b", # \iint, based on \int
49
52
  u"\u222d": u"\u222b", # \iiint, based on \int