katex 0.16.9 → 0.16.11

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
@@ -254,12 +254,34 @@ var assert = function assert(value) {
254
254
  };
255
255
  /**
256
256
  * Return the protocol of a URL, or "_relative" if the URL does not specify a
257
- * protocol (and thus is relative).
257
+ * protocol (and thus is relative), or `null` if URL has invalid protocol
258
+ * (so should be outright rejected).
258
259
  */
259
260
 
260
261
  var protocolFromUrl = function protocolFromUrl(url) {
261
- var protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
262
- return protocol != null ? protocol[1] : "_relative";
262
+ // Check for possible leading protocol.
263
+ // https://url.spec.whatwg.org/#url-parsing strips leading whitespace
264
+ // (U+20) or C0 control (U+00-U+1F) characters.
265
+ // eslint-disable-next-line no-control-regex
266
+ var protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(url);
267
+
268
+ if (!protocol) {
269
+ return "_relative";
270
+ } // Reject weird colons
271
+
272
+
273
+ if (protocol[2] !== ":") {
274
+ return null;
275
+ } // Reject invalid characters in scheme according to
276
+ // https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
277
+
278
+
279
+ if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
280
+ return null;
281
+ } // Lowercase the protocol
282
+
283
+
284
+ return protocol[1].toLowerCase();
263
285
  };
264
286
  var utils = {
265
287
  contains,
@@ -509,7 +531,13 @@ class Settings {
509
531
 
510
532
  isTrusted(context) {
511
533
  if (context.url && !context.protocol) {
512
- context.protocol = utils.protocolFromUrl(context.url);
534
+ var protocol = utils.protocolFromUrl(context.url);
535
+
536
+ if (protocol == null) {
537
+ return false;
538
+ }
539
+
540
+ context.protocol = protocol;
513
541
  }
514
542
 
515
543
  var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
@@ -3232,7 +3260,7 @@ var sigmasAndXis = {
3232
3260
  sqrtRuleThickness: [0.04, 0.04, 0.04],
3233
3261
  // This value determines how large a pt is, for metrics which are defined
3234
3262
  // in terms of pts.
3235
- // 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
3236
3264
  // values match.
3237
3265
  ptPerEm: [10.0, 10.0, 10.0],
3238
3266
  // The space between adjacent `|` columns in an array definition. From
@@ -4083,7 +4111,7 @@ class Img {
4083
4111
  }
4084
4112
 
4085
4113
  toMarkup() {
4086
- var markup = "<img src='" + this.src + " 'alt='" + this.alt + "' "; // Add the styles, after hyphenation
4114
+ var markup = "<img src=\"" + utils.escape(this.src) + "\"" + (" alt=\"" + utils.escape(this.alt) + "\""); // Add the styles, after hyphenation
4087
4115
 
4088
4116
  var styles = "";
4089
4117
 
@@ -4274,7 +4302,7 @@ class SvgNode {
4274
4302
 
4275
4303
  for (var attr in this.attributes) {
4276
4304
  if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
4277
- markup += " " + attr + "='" + this.attributes[attr] + "'";
4305
+ markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
4278
4306
  }
4279
4307
  }
4280
4308
 
@@ -4312,9 +4340,9 @@ class PathNode {
4312
4340
 
4313
4341
  toMarkup() {
4314
4342
  if (this.alternate) {
4315
- return "<path d='" + this.alternate + "'/>";
4343
+ return "<path d=\"" + utils.escape(this.alternate) + "\"/>";
4316
4344
  } else {
4317
- return "<path d='" + path[this.pathName] + "'/>";
4345
+ return "<path d=\"" + utils.escape(path[this.pathName]) + "\"/>";
4318
4346
  }
4319
4347
  }
4320
4348
 
@@ -4343,7 +4371,7 @@ class LineNode {
4343
4371
 
4344
4372
  for (var attr in this.attributes) {
4345
4373
  if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
4346
- markup += " " + attr + "='" + this.attributes[attr] + "'";
4374
+ markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
4347
4375
  }
4348
4376
  }
4349
4377
 
@@ -4545,7 +4573,7 @@ defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown", true);
4545
4573
  defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
4546
4574
  defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true); // AMS Negated Binary Relations
4547
4575
 
4548
- defineSymbol(math, ams, rel, "\u226e", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
4576
+ defineSymbol(math, ams, rel, "\u226e", "\\nless", true); // Symbol names preceded by "@" each have a corresponding macro.
4549
4577
 
4550
4578
  defineSymbol(math, ams, rel, "\ue010", "\\@nleqslant");
4551
4579
  defineSymbol(math, ams, rel, "\ue011", "\\@nleqq");
@@ -5168,11 +5196,11 @@ for (var _i3 = 0; _i3 < letters.length; _i3++) {
5168
5196
 
5169
5197
  defineSymbol(math, main, mathord, _ch3, wideChar);
5170
5198
  defineSymbol(text, main, textord, _ch3, wideChar);
5171
- wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur
5199
+ wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fraktur
5172
5200
 
5173
5201
  defineSymbol(math, main, mathord, _ch3, wideChar);
5174
5202
  defineSymbol(text, main, textord, _ch3, wideChar);
5175
- 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
5176
5204
 
5177
5205
  defineSymbol(math, main, mathord, _ch3, wideChar);
5178
5206
  defineSymbol(text, main, textord, _ch3, wideChar);
@@ -14651,9 +14679,11 @@ var optionsWithFont = (group, options) => {
14651
14679
  return options.withTextFontFamily(textFontFamilies[font]);
14652
14680
  } else if (textFontWeights[font]) {
14653
14681
  return options.withTextFontWeight(textFontWeights[font]);
14654
- } else {
14655
- return options.withTextFontShape(textFontShapes[font]);
14682
+ } else if (font === "\\emph") {
14683
+ return options.fontShape === "textit" ? options.withTextFontShape("textup") : options.withTextFontShape("textit");
14656
14684
  }
14685
+
14686
+ return options.withTextFontShape(textFontShapes[font]);
14657
14687
  };
14658
14688
 
14659
14689
  defineFunction({
@@ -14661,7 +14691,7 @@ defineFunction({
14661
14691
  names: [// Font families
14662
14692
  "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
14663
14693
  "\\textbf", "\\textmd", // Font Shapes
14664
- "\\textit", "\\textup"],
14694
+ "\\textit", "\\textup", "\\emph"],
14665
14695
  props: {
14666
14696
  numArgs: 1,
14667
14697
  argTypes: ["text"],
@@ -16334,6 +16364,19 @@ class MacroExpander {
16334
16364
 
16335
16365
  return args;
16336
16366
  }
16367
+ /**
16368
+ * Increment `expansionCount` by the specified amount.
16369
+ * Throw an error if it exceeds `maxExpand`.
16370
+ */
16371
+
16372
+
16373
+ countExpansion(amount) {
16374
+ this.expansionCount += amount;
16375
+
16376
+ if (this.expansionCount > this.settings.maxExpand) {
16377
+ throw new ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting");
16378
+ }
16379
+ }
16337
16380
  /**
16338
16381
  * Expand the next token only once if possible.
16339
16382
  *
@@ -16369,12 +16412,7 @@ class MacroExpander {
16369
16412
  return false;
16370
16413
  }
16371
16414
 
16372
- this.expansionCount++;
16373
-
16374
- if (this.expansionCount > this.settings.maxExpand) {
16375
- throw new ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting");
16376
- }
16377
-
16415
+ this.countExpansion(1);
16378
16416
  var tokens = expansion.tokens;
16379
16417
  var args = this.consumeArgs(expansion.numArgs, expansion.delimiters);
16380
16418
 
@@ -16480,8 +16518,11 @@ class MacroExpander {
16480
16518
 
16481
16519
  output.push(token);
16482
16520
  }
16483
- }
16521
+ } // Count all of these tokens as additional expansions, to prevent
16522
+ // exponential blowup from linearly many \edef's.
16523
+
16484
16524
 
16525
+ this.countExpansion(output.length);
16485
16526
  return output;
16486
16527
  }
16487
16528
  /**
@@ -17489,8 +17530,9 @@ class Parser {
17489
17530
  // We treat these similarly to the unicode-math package.
17490
17531
  // So we render a string of Unicode (sub|super)scripts the
17491
17532
  // same as a (sub|super)script of regular characters.
17492
- var str = uSubsAndSups[lex.text];
17493
17533
  var isSub = unicodeSubRegEx.test(lex.text);
17534
+ var subsupTokens = [];
17535
+ subsupTokens.push(new Token(uSubsAndSups[lex.text]));
17494
17536
  this.consume(); // Continue fetching tokens to fill out the string.
17495
17537
 
17496
17538
  while (true) {
@@ -17504,12 +17546,12 @@ class Parser {
17504
17546
  break;
17505
17547
  }
17506
17548
 
17549
+ subsupTokens.unshift(new Token(uSubsAndSups[token]));
17507
17550
  this.consume();
17508
- str += uSubsAndSups[token];
17509
17551
  } // Now create a (sub|super)script.
17510
17552
 
17511
17553
 
17512
- var body = new Parser(str, this.settings).parse();
17554
+ var body = this.subparse(subsupTokens);
17513
17555
 
17514
17556
  if (isSub) {
17515
17557
  subscript = {
@@ -18319,7 +18361,7 @@ var katex = {
18319
18361
  /**
18320
18362
  * Current KaTeX version
18321
18363
  */
18322
- version: "0.16.9",
18364
+ version: "0.16.11",
18323
18365
 
18324
18366
  /**
18325
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.9",
3
+ "version": "0.16.11",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "exports": {
@@ -47,7 +47,7 @@
47
47
  "dist/"
48
48
  ],
49
49
  "license": "MIT",
50
- "packageManager": "yarn@3.2.2",
50
+ "packageManager": "yarn@4.1.1",
51
51
  "devDependencies": {
52
52
  "@babel/core": "^7.18.13",
53
53
  "@babel/eslint-parser": "^7.18.9",
@@ -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
111
  "rollup": "^2.78.1",
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",
@@ -245,6 +245,18 @@ export default class MacroExpander implements MacroContextInterface {
245
245
  return args;
246
246
  }
247
247
 
248
+ /**
249
+ * Increment `expansionCount` by the specified amount.
250
+ * Throw an error if it exceeds `maxExpand`.
251
+ */
252
+ countExpansion(amount: number): void {
253
+ this.expansionCount += amount;
254
+ if (this.expansionCount > this.settings.maxExpand) {
255
+ throw new ParseError("Too many expansions: infinite loop or " +
256
+ "need to increase maxExpand setting");
257
+ }
258
+ }
259
+
248
260
  /**
249
261
  * Expand the next token only once if possible.
250
262
  *
@@ -276,11 +288,7 @@ export default class MacroExpander implements MacroContextInterface {
276
288
  this.pushToken(topToken);
277
289
  return false;
278
290
  }
279
- this.expansionCount++;
280
- if (this.expansionCount > this.settings.maxExpand) {
281
- throw new ParseError("Too many expansions: infinite loop or " +
282
- "need to increase maxExpand setting");
283
- }
291
+ this.countExpansion(1);
284
292
  let tokens = expansion.tokens;
285
293
  const args = this.consumeArgs(expansion.numArgs, expansion.delimiters);
286
294
  if (expansion.numArgs) {
@@ -375,6 +383,9 @@ export default class MacroExpander implements MacroContextInterface {
375
383
  output.push(token);
376
384
  }
377
385
  }
386
+ // Count all of these tokens as additional expansions, to prevent
387
+ // exponential blowup from linearly many \edef's.
388
+ this.countExpansion(output.length);
378
389
  return output;
379
390
  }
380
391
 
package/src/Parser.js CHANGED
@@ -405,19 +405,20 @@ export default class Parser {
405
405
  // We treat these similarly to the unicode-math package.
406
406
  // So we render a string of Unicode (sub|super)scripts the
407
407
  // same as a (sub|super)script of regular characters.
408
- let str = uSubsAndSups[lex.text];
409
408
  const isSub = unicodeSubRegEx.test(lex.text);
409
+ const subsupTokens = [];
410
+ subsupTokens.push(new Token(uSubsAndSups[lex.text]));
410
411
  this.consume();
411
412
  // Continue fetching tokens to fill out the string.
412
413
  while (true) {
413
414
  const token = this.fetch().text;
414
415
  if (!(uSubsAndSups[token])) { break; }
415
416
  if (unicodeSubRegEx.test(token) !== isSub) { break; }
417
+ subsupTokens.unshift(new Token(uSubsAndSups[token]));
416
418
  this.consume();
417
- str += uSubsAndSups[token];
418
419
  }
419
420
  // Now create a (sub|super)script.
420
- const body = (new Parser(str, this.settings)).parse();
421
+ const body = this.subparse(subsupTokens);
421
422
  if (isSub) {
422
423
  subscript = {type: "ordgroup", mode: "math", body};
423
424
  } else {
package/src/Settings.js CHANGED
@@ -346,7 +346,11 @@ export default class Settings {
346
346
  */
347
347
  isTrusted(context: AnyTrustContext): boolean {
348
348
  if (context.url && !context.protocol) {
349
- context.protocol = utils.protocolFromUrl(context.url);
349
+ const protocol = utils.protocolFromUrl(context.url);
350
+ if (protocol == null) {
351
+ return false;
352
+ }
353
+ context.protocol = protocol;
350
354
  }
351
355
  const trust = typeof this.trust === "function"
352
356
  ? this.trust(context)
package/src/domTree.js CHANGED
@@ -315,7 +315,8 @@ export class Img implements VirtualNode {
315
315
  }
316
316
 
317
317
  toMarkup(): string {
318
- let markup = `<img src='${this.src} 'alt='${this.alt}' `;
318
+ let markup = `<img src="${utils.escape(this.src)}"` +
319
+ ` alt="${utils.escape(this.alt)}"`;
319
320
 
320
321
  // Add the styles, after hyphenation
321
322
  let styles = "";
@@ -512,7 +513,7 @@ export class SvgNode implements VirtualNode {
512
513
  // Apply attributes
513
514
  for (const attr in this.attributes) {
514
515
  if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
515
- markup += ` ${attr}='${this.attributes[attr]}'`;
516
+ markup += ` ${attr}="${utils.escape(this.attributes[attr])}"`;
516
517
  }
517
518
  }
518
519
 
@@ -553,9 +554,9 @@ export class PathNode implements VirtualNode {
553
554
 
554
555
  toMarkup(): string {
555
556
  if (this.alternate) {
556
- return `<path d='${this.alternate}'/>`;
557
+ return `<path d="${utils.escape(this.alternate)}"/>`;
557
558
  } else {
558
- return `<path d='${path[this.pathName]}'/>`;
559
+ return `<path d="${utils.escape(path[this.pathName])}"/>`;
559
560
  }
560
561
  }
561
562
  }
@@ -586,7 +587,7 @@ export class LineNode implements VirtualNode {
586
587
 
587
588
  for (const attr in this.attributes) {
588
589
  if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
589
- markup += ` ${attr}='${this.attributes[attr]}'`;
590
+ markup += ` ${attr}="${utils.escape(this.attributes[attr])}"`;
590
591
  }
591
592
  }
592
593
 
@@ -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,11 @@
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
9
 
10
10
  .katex {
11
11
  font: normal 1.21em KaTeX_Main, Times New Roman, serif;
@@ -27,7 +27,7 @@
27
27
  }
28
28
 
29
29
  .katex-version::after {
30
- content: @version;
30
+ content: $version;
31
31
  }
32
32
 
33
33
  .katex-mathml {
@@ -168,13 +168,13 @@
168
168
 
169
169
  // This value is also used in fontMetrics.js, if you change it make sure the
170
170
  // values match.
171
- @ptperem: 10;
172
- @nulldelimiterspace: (1.2em / @ptperem);
171
+ $ptperem: 10;
172
+ $nulldelimiterspace: calc(1.2em / $ptperem);
173
173
 
174
- @muspace: 0.055556em; // 1mu
175
- @thinspace: 0.16667em; // 3mu
176
- @mediumspace: 0.22222em; // 4mu
177
- @thickspace: 0.27778em; // 5mu
174
+ $muspace: 0.055556em; // 1mu
175
+ $thinspace: 0.16667em; // 3mu
176
+ $mediumspace: 0.22222em; // 4mu
177
+ $thickspace: 0.27778em; // 5mu
178
178
 
179
179
  .vlist-t {
180
180
  display: inline-table;
@@ -328,47 +328,23 @@
328
328
  > .root {
329
329
  /* These values are taken from the definition of `\r@@t`,
330
330
  `\mkern 5mu` and `\mkern -10mu`. */
331
- margin-left: 5*@mu;
332
- margin-right: -10*@mu;
331
+ margin-left: calc(5*$mu);
332
+ margin-right: calc(-10*$mu);
333
333
  }
334
334
  }
335
335
 
336
336
  .sizing,
337
337
  .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;
338
+ $sizes: 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.44, 1.728, 2.074, 2.488;
339
+
340
+ @for $from from 1 through length($sizes) {
341
+ @for $to from 1 through length($sizes) {
342
+ &.reset-size#{$from}.size#{$to} {
343
+ /* stylelint-disable-next-line */
344
+ font-size: calc((nth($sizes, $to) / nth($sizes, $from)) * 1em);
345
+ }
356
346
  }
357
347
  }
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
348
  }
373
349
 
374
350
  .delimsizing {
@@ -390,7 +366,7 @@
390
366
 
391
367
  .nulldelimiter {
392
368
  display: inline-block;
393
- width: @nulldelimiterspace;
369
+ width: $nulldelimiterspace;
394
370
  }
395
371
 
396
372
  .delimcenter {
package/src/symbols.js CHANGED
@@ -204,7 +204,7 @@ defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true);
204
204
 
205
205
  // AMS Negated Binary Relations
206
206
  defineSymbol(math, ams, rel, "\u226e", "\\nless", true);
207
- // Symbol names preceeded by "@" each have a corresponding macro.
207
+ // Symbol names preceded by "@" each have a corresponding macro.
208
208
  defineSymbol(math, ams, rel, "\ue010", "\\@nleqslant");
209
209
  defineSymbol(math, ams, rel, "\ue011", "\\@nleqq");
210
210
  defineSymbol(math, ams, rel, "\u2a87", "\\lneq", true);
@@ -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