temml 0.10.23 → 0.10.29

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.
@@ -30,9 +30,12 @@ const styleWithFont = (group, style) => {
30
30
  return style.withTextFontFamily(textFontFamilies[font]);
31
31
  } else if (textFontWeights[font]) {
32
32
  return style.withTextFontWeight(textFontWeights[font]);
33
- } else {
34
- return style.withTextFontShape(textFontShapes[font]);
33
+ } else if (font === "\\emph") {
34
+ return style.fontShape === "textit"
35
+ ? style.withTextFontShape("textup")
36
+ : style.withTextFontShape("textit")
35
37
  }
38
+ return style.withTextFontShape(textFontShapes[font])
36
39
  };
37
40
 
38
41
  defineFunction({
@@ -50,7 +53,8 @@ defineFunction({
50
53
  "\\textmd",
51
54
  // Font Shapes
52
55
  "\\textit",
53
- "\\textup"
56
+ "\\textup",
57
+ "\\emph"
54
58
  ],
55
59
  props: {
56
60
  numArgs: 1,
package/src/macros.js CHANGED
@@ -82,7 +82,7 @@ defineMacro("\\TextOrMath", function(context) {
82
82
  }
83
83
  });
84
84
 
85
- const stringFromArg = arg => {
85
+ export const stringFromArg = arg => {
86
86
  // Reverse the order of the arg and return a string.
87
87
  let str = ""
88
88
  for (let i = arg.length - 1; i > -1; i--) {
@@ -246,6 +246,10 @@ defineMacro("\\underbar", "\\underline{\\text{#1}}");
246
246
  defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
247
247
  defineMacro("\u22ee", "\\vdots");
248
248
 
249
+ // {array} environment gaps
250
+ defineMacro("\\arraystretch", "1") // line spacing factor times 12pt
251
+ defineMacro("\\arraycolsep", "6pt") // half the width separating columns
252
+
249
253
  //////////////////////////////////////////////////////////////////////
250
254
  // amsmath.sty
251
255
  // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf
@@ -8,7 +8,7 @@
8
8
  * https://mit-license.org/
9
9
  */
10
10
 
11
- export const version = "0.10.23";
11
+ export const version = "0.10.29";
12
12
 
13
13
  export function postProcess(block) {
14
14
  const labelMap = {}
package/src/symbols.js CHANGED
@@ -427,6 +427,7 @@ defineSymbol(math, bin, "\u22d3", "\\Cup", true);
427
427
  defineSymbol(math, bin, "\u2a5e", "\\doublebarwedge", true);
428
428
  defineSymbol(math, bin, "\u229f", "\\boxminus", true);
429
429
  defineSymbol(math, bin, "\u229e", "\\boxplus", true);
430
+ defineSymbol(math, bin, "\u29C4", "\\boxslash", true);
430
431
  defineSymbol(math, bin, "\u22c7", "\\divideontimes", true);
431
432
  defineSymbol(math, bin, "\u22c9", "\\ltimes", true);
432
433
  defineSymbol(math, bin, "\u22ca", "\\rtimes", true);
@@ -446,7 +447,72 @@ defineSymbol(math, bin, "\u27d5", "\\leftouterjoin", true);
446
447
  defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
447
448
  defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
448
449
 
449
- defineSymbol(math, bin, "\u2238", "\\dotminus", true); // stix
450
+ // stix Binary Operators
451
+ defineSymbol(math, bin, "\u2238", "\\dotminus", true);
452
+ defineSymbol(math, bin, "\u27D1", "\\wedgedot", true);
453
+ defineSymbol(math, bin, "\u27C7", "\\veedot", true);
454
+ defineSymbol(math, bin, "\u2A62", "\\doublebarvee", true);
455
+ defineSymbol(math, bin, "\u2A63", "\\veedoublebar", true)
456
+ defineSymbol(math, bin, "\u2A5F", "\\wedgebar", true)
457
+ defineSymbol(math, bin, "\u2A60", "\\wedgedoublebar", true)
458
+ defineSymbol(math, bin, "\u2A54", "\\Vee", true)
459
+ defineSymbol(math, bin, "\u2A53", "\\Wedge", true)
460
+ defineSymbol(math, bin, "\u2A43", "\\barcap", true)
461
+ defineSymbol(math, bin, "\u2A42", "\\barcup", true)
462
+ defineSymbol(math, bin, "\u2A48", "\\capbarcup", true)
463
+ defineSymbol(math, bin, "\u2A40", "\\capdot", true)
464
+ defineSymbol(math, bin, "\u2A47", "\\capovercup", true)
465
+ defineSymbol(math, bin, "\u2A46", "\\cupovercap", true)
466
+ defineSymbol(math, bin, "\u2A4D", "\\closedvarcap", true)
467
+ defineSymbol(math, bin, "\u2A4C", "\\closedvarcup", true)
468
+ defineSymbol(math, bin, "\u2A2A", "\\minusdot", true)
469
+ defineSymbol(math, bin, "\u2A2B", "\\minusfdots", true)
470
+ defineSymbol(math, bin, "\u2A2C", "\\minusrdots", true)
471
+ defineSymbol(math, bin, "\u22BB", "\\Xor", true)
472
+ defineSymbol(math, bin, "\u22BC", "\\Nand", true)
473
+ defineSymbol(math, bin, "\u22BD", "\\Nor", true)
474
+ defineSymbol(math, bin, "\u22BD", "\\barvee")
475
+ defineSymbol(math, bin, "\u2AF4", "\\interleave", true)
476
+ defineSymbol(math, bin, "\u29E2", "\\shuffle", true)
477
+ defineSymbol(math, bin, "\u2AF6", "\\threedotcolon", true)
478
+ defineSymbol(math, bin, "\u2982", "\\typecolon", true)
479
+ defineSymbol(math, bin, "\u223E", "\\invlazys", true)
480
+ defineSymbol(math, bin, "\u2A4B", "\\twocaps", true)
481
+ defineSymbol(math, bin, "\u2A4A", "\\twocups", true)
482
+ defineSymbol(math, bin, "\u2A4E", "\\Sqcap", true)
483
+ defineSymbol(math, bin, "\u2A4F", "\\Sqcup", true)
484
+ defineSymbol(math, bin, "\u2A56", "\\veeonvee", true)
485
+ defineSymbol(math, bin, "\u2A55", "\\wedgeonwedge", true)
486
+ defineSymbol(math, bin, "\u29D7", "\\blackhourglass", true)
487
+ defineSymbol(math, bin, "\u29C6", "\\boxast", true)
488
+ defineSymbol(math, bin, "\u29C8", "\\boxbox", true)
489
+ defineSymbol(math, bin, "\u29C7", "\\boxcircle", true)
490
+ defineSymbol(math, bin, "\u229C", "\\circledequal", true)
491
+ defineSymbol(math, bin, "\u29B7", "\\circledparallel", true)
492
+ defineSymbol(math, bin, "\u29B6", "\\circledvert", true)
493
+ defineSymbol(math, bin, "\u29B5", "\\circlehbar", true)
494
+ defineSymbol(math, bin, "\u27E1", "\\concavediamond", true)
495
+ defineSymbol(math, bin, "\u27E2", "\\concavediamondtickleft", true)
496
+ defineSymbol(math, bin, "\u27E3", "\\concavediamondtickright", true)
497
+ defineSymbol(math, bin, "\u22C4", "\\diamond", true)
498
+ defineSymbol(math, bin, "\u29D6", "\\hourglass", true)
499
+ defineSymbol(math, bin, "\u27E0", "\\lozengeminus", true)
500
+ defineSymbol(math, bin, "\u233D", "\\obar", true)
501
+ defineSymbol(math, bin, "\u29B8", "\\obslash", true)
502
+ defineSymbol(math, bin, "\u2A38", "\\odiv", true)
503
+ defineSymbol(math, bin, "\u29C1", "\\ogreaterthan", true)
504
+ defineSymbol(math, bin, "\u29C0", "\\olessthan", true)
505
+ defineSymbol(math, bin, "\u29B9", "\\operp", true)
506
+ defineSymbol(math, bin, "\u2A37", "\\Otimes", true)
507
+ defineSymbol(math, bin, "\u2A36", "\\otimeshat", true)
508
+ defineSymbol(math, bin, "\u22C6", "\\star", true)
509
+ defineSymbol(math, bin, "\u25B3", "\\triangle", true)
510
+ defineSymbol(math, bin, "\u2A3A", "\\triangleminus", true)
511
+ defineSymbol(math, bin, "\u2A39", "\\triangleplus", true)
512
+ defineSymbol(math, bin, "\u2A3B", "\\triangletimes", true)
513
+ defineSymbol(math, bin, "\u27E4", "\\whitesquaretickleft", true)
514
+ defineSymbol(math, bin, "\u27E5", "\\whitesquaretickright", true)
515
+ defineSymbol(math, bin, "\u2A33", "\\smashtimes", true)
450
516
 
451
517
  // AMS Arrows
452
518
  // Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
@@ -688,8 +754,8 @@ defineSymbol(math, spacing, null, "\\allowbreak");
688
754
  defineSymbol(math, punct, ",", ",");
689
755
  defineSymbol(text, punct, ":", ":");
690
756
  defineSymbol(math, punct, ";", ";");
691
- defineSymbol(math, bin, "\u22bc", "\\barwedge", true);
692
- defineSymbol(math, bin, "\u22bb", "\\veebar", true);
757
+ defineSymbol(math, bin, "\u22bc", "\\barwedge");
758
+ defineSymbol(math, bin, "\u22bb", "\\veebar");
693
759
  defineSymbol(math, bin, "\u2299", "\\odot", true);
694
760
  // Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
695
761
  defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
@@ -702,7 +768,6 @@ defineSymbol(math, bin, "\u25b3", "\\bigtriangleup");
702
768
  defineSymbol(math, bin, "\u25bd", "\\bigtriangledown");
703
769
  defineSymbol(math, bin, "\u2020", "\\dagger");
704
770
  defineSymbol(math, bin, "\u22c4", "\\diamond");
705
- defineSymbol(math, bin, "\u22c6", "\\star");
706
771
  defineSymbol(math, bin, "\u25c3", "\\triangleleft");
707
772
  defineSymbol(math, bin, "\u25b9", "\\triangleright");
708
773
  defineSymbol(math, open, "{", "\\{");
@@ -747,6 +812,10 @@ defineSymbol(math, op, "\u2210", "\\coprod");
747
812
  defineSymbol(math, op, "\u22c1", "\\bigvee");
748
813
  defineSymbol(math, op, "\u22c0", "\\bigwedge");
749
814
  defineSymbol(math, op, "\u2a04", "\\biguplus");
815
+ defineSymbol(math, op, "\u2a04", "\\bigcupplus");
816
+ defineSymbol(math, op, "\u2a03", "\\bigcupdot");
817
+ defineSymbol(math, op, "\u2a07", "\\bigdoublevee");
818
+ defineSymbol(math, op, "\u2a08", "\\bigdoublewedge");
750
819
  defineSymbol(math, op, "\u22c2", "\\bigcap");
751
820
  defineSymbol(math, op, "\u22c3", "\\bigcup");
752
821
  defineSymbol(math, op, "\u222b", "\\int");
package/src/utils.js CHANGED
@@ -81,11 +81,29 @@ export const assert = function(value) {
81
81
 
82
82
  /**
83
83
  * Return the protocol of a URL, or "_relative" if the URL does not specify a
84
- * protocol (and thus is relative).
84
+ * protocol (and thus is relative), or `null` if URL has invalid protocol
85
+ * (so should be outright rejected).
85
86
  */
86
87
  export const protocolFromUrl = function(url) {
87
- const protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
88
- return protocol != null ? protocol[1] : "_relative";
88
+ // Check for possible leading protocol.
89
+ // https://url.spec.whatwg.org/#url-parsing strips leading whitespace
90
+ // (\x00) or C0 control (\x00-\x1F) characters.
91
+ // eslint-disable-next-line no-control-regex
92
+ const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(url);
93
+ if (!protocol) {
94
+ return "_relative";
95
+ }
96
+ // Reject weird colons
97
+ if (protocol[2] !== ":") {
98
+ return null;
99
+ }
100
+ // Reject invalid characters in scheme according to
101
+ // https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
102
+ if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
103
+ return null;
104
+ }
105
+ // Lowercase the protocol
106
+ return protocol[1].toLowerCase();
89
107
  };
90
108
 
91
109
  /**