katex 0.16.10 → 0.16.12

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/dist/katex.mjs CHANGED
@@ -3260,7 +3260,7 @@ var sigmasAndXis = {
3260
3260
  sqrtRuleThickness: [0.04, 0.04, 0.04],
3261
3261
  // This value determines how large a pt is, for metrics which are defined
3262
3262
  // in terms of pts.
3263
- // This value is also used in katex.less; if you change it make sure the
3263
+ // This value is also used in katex.scss; if you change it make sure the
3264
3264
  // values match.
3265
3265
  ptPerEm: [10.0, 10.0, 10.0],
3266
3266
  // The space between adjacent `|` columns in an array definition. From
@@ -5196,11 +5196,11 @@ for (var _i3 = 0; _i3 < letters.length; _i3++) {
5196
5196
 
5197
5197
  defineSymbol(math, main, mathord, _ch3, wideChar);
5198
5198
  defineSymbol(text, main, textord, _ch3, wideChar);
5199
- wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur
5199
+ wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fraktur
5200
5200
 
5201
5201
  defineSymbol(math, main, mathord, _ch3, wideChar);
5202
5202
  defineSymbol(text, main, textord, _ch3, wideChar);
5203
- wideChar = String.fromCharCode(0xD835, 0xDD6C + _i3); // A-Z a-z bold Fractur
5203
+ wideChar = String.fromCharCode(0xD835, 0xDD6C + _i3); // A-Z a-z bold Fraktur
5204
5204
 
5205
5205
  defineSymbol(math, main, mathord, _ch3, wideChar);
5206
5206
  defineSymbol(text, main, textord, _ch3, wideChar);
@@ -14679,9 +14679,11 @@ var optionsWithFont = (group, options) => {
14679
14679
  return options.withTextFontFamily(textFontFamilies[font]);
14680
14680
  } else if (textFontWeights[font]) {
14681
14681
  return options.withTextFontWeight(textFontWeights[font]);
14682
- } else {
14683
- return options.withTextFontShape(textFontShapes[font]);
14682
+ } else if (font === "\\emph") {
14683
+ return options.fontShape === "textit" ? options.withTextFontShape("textup") : options.withTextFontShape("textit");
14684
14684
  }
14685
+
14686
+ return options.withTextFontShape(textFontShapes[font]);
14685
14687
  };
14686
14688
 
14687
14689
  defineFunction({
@@ -14689,7 +14691,7 @@ defineFunction({
14689
14691
  names: [// Font families
14690
14692
  "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
14691
14693
  "\\textbf", "\\textmd", // Font Shapes
14692
- "\\textit", "\\textup"],
14694
+ "\\textit", "\\textup", "\\emph"],
14693
14695
  props: {
14694
14696
  numArgs: 1,
14695
14697
  argTypes: ["text"],
@@ -18359,7 +18361,7 @@ var katex = {
18359
18361
  /**
18360
18362
  * Current KaTeX version
18361
18363
  */
18362
- version: "0.16.10",
18364
+ version: "0.16.12",
18363
18365
 
18364
18366
  /**
18365
18367
  * 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.16.10",
3
+ "version": "0.16.12",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "exports": {
@@ -97,26 +97,27 @@
97
97
  "js-yaml": "^4.1.0",
98
98
  "json-stable-stringify": "^1.0.1",
99
99
  "jspngopt": "^0.2.0",
100
- "less": "^4.1.3",
101
- "less-loader": "^11.0.0",
102
100
  "mini-css-extract-plugin": "^2.6.1",
103
101
  "mkdirp": "^1.0.4",
104
102
  "p-retry": "^4.6.2",
105
103
  "pako": "^2.0.4",
106
104
  "postcss": "^8.4.16",
107
- "postcss-less": "^6.0.0",
108
105
  "postcss-loader": "^7.0.1",
109
106
  "postcss-preset-env": "^7.8.0",
107
+ "postcss-scss": "^4.0.9",
110
108
  "prettier": "^2.7.1",
111
109
  "query-string": "^7.1.1",
112
110
  "rimraf": "^3.0.2",
113
- "rollup": "^2.78.1",
111
+ "rollup": "^2.79.2",
112
+ "sass": "^1.75.6",
113
+ "sass-loader": "^14.2.1",
114
114
  "selenium-webdriver": "^4.4.0",
115
115
  "semantic-release": "^19.0.5",
116
116
  "sri-toolbox": "^0.2.0",
117
117
  "style-loader": "^3.3.1",
118
118
  "stylelint": "^14.11.0",
119
119
  "stylelint-config-standard": "^28.0.0",
120
+ "stylelint-scss": "^6.3.2",
120
121
  "terser-webpack-plugin": "^5.3.6",
121
122
  "webpack": "^5.74.0",
122
123
  "webpack-bundle-analyzer": "^4.6.1",
@@ -128,7 +129,7 @@
128
129
  "test": "yarn test:lint && yarn test:flow && yarn test:jest",
129
130
  "test:lint": "yarn test:lint:js && yarn test:lint:css",
130
131
  "test:lint:js": "eslint .",
131
- "test:lint:css": "stylelint src/katex.less static/main.css website/static/**/*.css",
132
+ "test:lint:css": "stylelint src/styles/katex.scss static/main.css website/static/**/*.css",
132
133
  "test:flow": "flow",
133
134
  "test:jest": "jest",
134
135
  "test:jest:watch": "jest --watch",
@@ -75,7 +75,7 @@ const sigmasAndXis = {
75
75
 
76
76
  // This value determines how large a pt is, for metrics which are defined
77
77
  // in terms of pts.
78
- // This value is also used in katex.less; if you change it make sure the
78
+ // This value is also used in katex.scss; if you change it make sure the
79
79
  // values match.
80
80
  ptPerEm: [10.0, 10.0, 10.0],
81
81
 
@@ -30,9 +30,13 @@ const optionsWithFont = (group, options) => {
30
30
  return options.withTextFontFamily(textFontFamilies[font]);
31
31
  } else if (textFontWeights[font]) {
32
32
  return options.withTextFontWeight(textFontWeights[font]);
33
- } else {
34
- return options.withTextFontShape(textFontShapes[font]);
33
+ } else if (font === "\\emph") {
34
+ return options.fontShape === "textit" ?
35
+ options.withTextFontShape("textup") :
36
+ options.withTextFontShape("textit");
35
37
  }
38
+
39
+ return options.withTextFontShape(textFontShapes[font]);
36
40
  };
37
41
 
38
42
  defineFunction({
@@ -43,7 +47,7 @@ defineFunction({
43
47
  // Font weights
44
48
  "\\textbf", "\\textmd",
45
49
  // Font Shapes
46
- "\\textit", "\\textup",
50
+ "\\textit", "\\textup", "\\emph",
47
51
  ],
48
52
  props: {
49
53
  numArgs: 1,
@@ -0,0 +1,71 @@
1
+ $font-folder: "../../fonts" !default;
2
+ $use-woff2: true !default;
3
+ $use-woff: true !default;
4
+ $use-ttf: true !default;
5
+
6
+ @function generate-src($family, $family-suffix) {
7
+ $src: null;
8
+ @if $use-woff2 {
9
+ $src: append($src, url('#{$font-folder}/KaTeX_#{$family}-#{$family-suffix}.woff2') format('woff2'), comma);
10
+ }
11
+ @if $use-woff {
12
+ $src: append($src, url('#{$font-folder}/KaTeX_#{$family}-#{$family-suffix}.woff') format('woff'), comma);
13
+ }
14
+ @if $use-ttf {
15
+ $src: append($src, url('#{$font-folder}/KaTeX_#{$family}-#{$family-suffix}.ttf') format('truetype'), comma);
16
+ }
17
+
18
+ @return $src;
19
+ }
20
+
21
+ @function generate-suffix($weight, $style) {
22
+ $suffix: null;
23
+
24
+ @if $weight == normal and $style == normal {
25
+ $suffix: 'Regular';
26
+ }
27
+ @if $weight == normal and $style == italic {
28
+ $suffix: 'Italic';
29
+ }
30
+ @if $weight == bold and $style == normal {
31
+ $suffix: 'Bold';
32
+ }
33
+ @if $weight == bold and $style == italic {
34
+ $suffix: 'BoldItalic';
35
+ }
36
+
37
+ @return $suffix;
38
+ }
39
+
40
+ @mixin font-face($family, $weight, $style) {
41
+ $suffix: generate-suffix($weight, $style);
42
+ $src: generate-src($family, $suffix);
43
+
44
+ @font-face {
45
+ font-family: 'KaTeX_#{$family}';
46
+ src: $src;
47
+ font-weight: $weight;
48
+ font-style: $style;
49
+ }
50
+ }
51
+
52
+ @include font-face('AMS', normal, normal);
53
+ @include font-face('Caligraphic', bold, normal);
54
+ @include font-face('Caligraphic', normal, normal);
55
+ @include font-face('Fraktur', bold, normal);
56
+ @include font-face('Fraktur', normal, normal);
57
+ @include font-face('Main', bold, normal);
58
+ @include font-face('Main', bold, italic);
59
+ @include font-face('Main', normal, italic);
60
+ @include font-face('Main', normal, normal);
61
+ @include font-face('Math', bold, italic);
62
+ @include font-face('Math', normal, italic);
63
+ @include font-face('SansSerif', bold, normal);
64
+ @include font-face('SansSerif', normal, italic);
65
+ @include font-face('SansSerif', normal, normal);
66
+ @include font-face('Script', normal, normal);
67
+ @include font-face('Size1', normal, normal);
68
+ @include font-face('Size2', normal, normal);
69
+ @include font-face('Size3', normal, normal);
70
+ @include font-face('Size4', normal, normal);
71
+ @include font-face('Typewriter', normal, normal);
@@ -1,11 +1,14 @@
1
1
  /* stylelint-disable font-family-no-missing-generic-family-keyword */
2
- @import "fonts.less";
2
+ @import "./fonts.scss";
3
3
 
4
4
  // The mu unit is defined as 1/18 em
5
- @mu: (1em / 18);
5
+ $mu: calc(1em / 18);
6
6
 
7
7
  // The version is dynamically set from package.json via webpack.common.js
8
- @version: "";
8
+ $version: "" !default;
9
+
10
+ // CSS margin property for math in display mode
11
+ $display-margin: 1em 0 !default;
9
12
 
10
13
  .katex {
11
14
  font: normal 1.21em KaTeX_Main, Times New Roman, serif;
@@ -27,7 +30,7 @@
27
30
  }
28
31
 
29
32
  .katex-version::after {
30
- content: @version;
33
+ content: $version;
31
34
  }
32
35
 
33
36
  .katex-mathml {
@@ -168,13 +171,13 @@
168
171
 
169
172
  // This value is also used in fontMetrics.js, if you change it make sure the
170
173
  // values match.
171
- @ptperem: 10;
172
- @nulldelimiterspace: (1.2em / @ptperem);
174
+ $ptperem: 10;
175
+ $nulldelimiterspace: calc(1.2em / $ptperem);
173
176
 
174
- @muspace: 0.055556em; // 1mu
175
- @thinspace: 0.16667em; // 3mu
176
- @mediumspace: 0.22222em; // 4mu
177
- @thickspace: 0.27778em; // 5mu
177
+ $muspace: 0.055556em; // 1mu
178
+ $thinspace: 0.16667em; // 3mu
179
+ $mediumspace: 0.22222em; // 4mu
180
+ $thickspace: 0.27778em; // 5mu
178
181
 
179
182
  .vlist-t {
180
183
  display: inline-table;
@@ -328,47 +331,23 @@
328
331
  > .root {
329
332
  /* These values are taken from the definition of `\r@@t`,
330
333
  `\mkern 5mu` and `\mkern -10mu`. */
331
- margin-left: 5*@mu;
332
- margin-right: -10*@mu;
334
+ margin-left: calc(5*$mu);
335
+ margin-right: calc(-10*$mu);
333
336
  }
334
337
  }
335
338
 
336
339
  .sizing,
337
340
  .fontsize-ensurer {
338
- @size1: 0.5;
339
- @size2: 0.6;
340
- @size3: 0.7;
341
- @size4: 0.8;
342
- @size5: 0.9;
343
- @size6: 1;
344
- @size7: 1.2;
345
- @size8: 1.44;
346
- @size9: 1.728;
347
- @size10: 2.074;
348
- @size11: 2.488;
349
-
350
- .generate-size-change(@from, @to) {
351
- &.reset-size@{from}.size@{to} {
352
- @sizeFromVariable: ~"size@{from}";
353
- @sizeToVariable: ~"size@{to}";
354
-
355
- font-size: (@@sizeToVariable / @@sizeFromVariable) * 1em;
341
+ $sizes: 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.44, 1.728, 2.074, 2.488;
342
+
343
+ @for $from from 1 through length($sizes) {
344
+ @for $to from 1 through length($sizes) {
345
+ &.reset-size#{$from}.size#{$to} {
346
+ /* stylelint-disable-next-line */
347
+ font-size: calc((nth($sizes, $to) / nth($sizes, $from)) * 1em);
348
+ }
356
349
  }
357
350
  }
358
-
359
- .generate-to-size-change(@from, @currTo) when (@currTo =< 11) {
360
- .generate-size-change(@from, @currTo);
361
-
362
- .generate-to-size-change(@from, (@currTo + 1));
363
- }
364
-
365
- .generate-from-size-change(@currFrom) when (@currFrom =< 11) {
366
- .generate-to-size-change(@currFrom, 1);
367
-
368
- .generate-from-size-change((@currFrom + 1));
369
- }
370
-
371
- .generate-from-size-change(1);
372
351
  }
373
352
 
374
353
  .delimsizing {
@@ -390,7 +369,7 @@
390
369
 
391
370
  .nulldelimiter {
392
371
  display: inline-block;
393
- width: @nulldelimiterspace;
372
+ width: $nulldelimiterspace;
394
373
  }
395
374
 
396
375
  .delimcenter {
@@ -645,7 +624,7 @@
645
624
 
646
625
  .katex-display {
647
626
  display: block;
648
- margin: 1em 0;
627
+ margin: $display-margin;
649
628
  text-align: center;
650
629
 
651
630
  > .katex {
package/src/symbols.js CHANGED
@@ -812,11 +812,11 @@ for (let i = 0; i < letters.length; i++) {
812
812
  defineSymbol(math, main, mathord, ch, wideChar);
813
813
  defineSymbol(text, main, textord, ch, wideChar);
814
814
 
815
- wideChar = String.fromCharCode(0xD835, 0xDD04 + i); // A-Z a-z Fractur
815
+ wideChar = String.fromCharCode(0xD835, 0xDD04 + i); // A-Z a-z Fraktur
816
816
  defineSymbol(math, main, mathord, ch, wideChar);
817
817
  defineSymbol(text, main, textord, ch, wideChar);
818
818
 
819
- wideChar = String.fromCharCode(0xD835, 0xDD6C + i); // A-Z a-z bold Fractur
819
+ wideChar = String.fromCharCode(0xD835, 0xDD6C + i); // A-Z a-z bold Fraktur
820
820
  defineSymbol(math, main, mathord, ch, wideChar);
821
821
  defineSymbol(text, main, textord, ch, wideChar);
822
822
 
package/src/fonts.less DELETED
@@ -1,64 +0,0 @@
1
- @font-folder: "../fonts";
2
- @use-ttf: true;
3
- @use-woff: true;
4
- @use-woff2: true;
5
-
6
- .use-woff2(@family, @family-suffix) when (@use-woff2 = true) {
7
- src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff2') format('woff2')
8
- }
9
-
10
- .use-woff(@family, @family-suffix) when (@use-woff = true) {
11
- src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff') format('woff')
12
- }
13
-
14
- .use-ttf(@family, @family-suffix) when (@use-ttf = true) {
15
- src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.ttf') format('truetype')
16
- }
17
-
18
- .generate-suffix(@weight, @style) when (@weight = normal) and (@style = normal) {
19
- @suffix: 'Regular';
20
- }
21
- .generate-suffix(@weight, @style) when (@weight = normal) and (@style = italic) {
22
- @suffix: 'Italic';
23
- }
24
- .generate-suffix(@weight, @style) when (@weight = bold) and (@style = normal) {
25
- @suffix: 'Bold';
26
- }
27
- .generate-suffix(@weight, @style) when (@weight = bold) and (@style = italic) {
28
- @suffix: 'BoldItalic';
29
- }
30
-
31
- .font-face(@family, @weight, @style) {
32
- .generate-suffix(@weight, @style);
33
- @font-face {
34
- font-family: 'KaTeX_@{family}';
35
- .use-woff2(@family, @suffix);
36
- .use-woff(@family, @suffix);
37
- .use-ttf(@family, @suffix);
38
- font-weight: @weight;
39
- font-style: @style;
40
- }
41
- }
42
-
43
- .font-face('AMS', normal, normal);
44
- .font-face('Caligraphic', bold, normal);
45
- .font-face('Caligraphic', normal, normal);
46
- .font-face('Fraktur', bold, normal);
47
- .font-face('Fraktur', normal, normal);
48
- .font-face('Main', bold, normal);
49
- .font-face('Main', bold, italic);
50
- .font-face('Main', normal, italic);
51
- .font-face('Main', normal, normal);
52
- //.font-face('Math', bold, normal);
53
- .font-face('Math', bold, italic);
54
- .font-face('Math', normal, italic);
55
- //.font-face('Math', normal, normal);
56
- .font-face('SansSerif', bold, normal);
57
- .font-face('SansSerif', normal, italic);
58
- .font-face('SansSerif', normal, normal);
59
- .font-face('Script', normal, normal);
60
- .font-face('Size1', normal, normal);
61
- .font-face('Size2', normal, normal);
62
- .font-face('Size3', normal, normal);
63
- .font-face('Size4', normal, normal);
64
- .font-face('Typewriter', normal, normal);