temml 0.10.23 → 0.10.24

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Library | Minified JavaScript + CSS |
4
4
  |:--------------|:-------------------------:|
5
- | Temml | 151 KB |
5
+ | Temml | 153 KB |
6
6
  | MathJax 2.7.5 | 338 KB |
7
7
  | KaTeX | 280 KB |
8
8
  | TeXZilla | 168 KB |
@@ -24,6 +24,8 @@ math {
24
24
  letter-spacing: normal;
25
25
  word-wrap: normal;
26
26
  direction: ltr;
27
+ /* Prevent Firefox from omitting the dot on i or j. */
28
+ font-feature-settings: "dtls" off;
27
29
  }
28
30
 
29
31
  math * {
@@ -31,6 +31,8 @@ math {
31
31
  letter-spacing: normal;
32
32
  word-wrap: normal;
33
33
  direction: ltr;
34
+ /* Prevent Firefox from omitting the dot on i or j. */
35
+ font-feature-settings: "dtls" off;
34
36
  }
35
37
 
36
38
  math * {
@@ -34,6 +34,8 @@ math {
34
34
  letter-spacing: normal;
35
35
  word-wrap: normal;
36
36
  direction: ltr;
37
+ /* Prevent Firefox from omitting the dot on i or j. */
38
+ font-feature-settings: "dtls" off;
37
39
  }
38
40
 
39
41
  math * {
@@ -32,6 +32,8 @@ math {
32
32
  letter-spacing: normal;
33
33
  word-wrap: normal;
34
34
  direction: ltr;
35
+ /* Prevent Firefox from omitting the dot on i or j. */
36
+ font-feature-settings: "dtls" off;
35
37
  }
36
38
 
37
39
  math * {
@@ -22,6 +22,8 @@ math {
22
22
  letter-spacing: normal;
23
23
  word-wrap: normal;
24
24
  direction: ltr;
25
+ /* Prevent Firefox from omitting the dot on i or j. */
26
+ font-feature-settings: "dtls" off;
25
27
  }
26
28
 
27
29
  math * {
@@ -22,6 +22,8 @@ math {
22
22
  letter-spacing: normal;
23
23
  word-wrap: normal;
24
24
  direction: ltr;
25
+ /* Prevent Firefox from omitting the dot on i or j. */
26
+ font-feature-settings: "dtls" off;
25
27
  }
26
28
 
27
29
  math * {
package/dist/temml.cjs CHANGED
@@ -146,11 +146,29 @@ const assert = function(value) {
146
146
 
147
147
  /**
148
148
  * Return the protocol of a URL, or "_relative" if the URL does not specify a
149
- * protocol (and thus is relative).
149
+ * protocol (and thus is relative), or `null` if URL has invalid protocol
150
+ * (so should be outright rejected).
150
151
  */
151
152
  const protocolFromUrl = function(url) {
152
- const protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
153
- return protocol != null ? protocol[1] : "_relative";
153
+ // Check for possible leading protocol.
154
+ // https://url.spec.whatwg.org/#url-parsing strips leading whitespace
155
+ // (\x00) or C0 control (\x00-\x1F) characters.
156
+ // eslint-disable-next-line no-control-regex
157
+ const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(url);
158
+ if (!protocol) {
159
+ return "_relative";
160
+ }
161
+ // Reject weird colons
162
+ if (protocol[2] !== ":") {
163
+ return null;
164
+ }
165
+ // Reject invalid characters in scheme according to
166
+ // https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
167
+ if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
168
+ return null;
169
+ }
170
+ // Lowercase the protocol
171
+ return protocol[1].toLowerCase();
154
172
  };
155
173
 
156
174
  /**
@@ -215,7 +233,11 @@ class Settings {
215
233
  */
216
234
  isTrusted(context) {
217
235
  if (context.url && !context.protocol) {
218
- context.protocol = utils.protocolFromUrl(context.url);
236
+ const protocol = utils.protocolFromUrl(context.url);
237
+ if (protocol == null) {
238
+ return false
239
+ }
240
+ context.protocol = protocol;
219
241
  }
220
242
  const trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
221
243
  return Boolean(trust);
@@ -1254,7 +1276,72 @@ defineSymbol(math, bin, "\u27d5", "\\leftouterjoin", true);
1254
1276
  defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
1255
1277
  defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
1256
1278
 
1257
- defineSymbol(math, bin, "\u2238", "\\dotminus", true); // stix
1279
+ // stix Binary Operators
1280
+ defineSymbol(math, bin, "\u2238", "\\dotminus", true);
1281
+ defineSymbol(math, bin, "\u27D1", "\\wedgedot", true);
1282
+ defineSymbol(math, bin, "\u27C7", "\\veedot", true);
1283
+ defineSymbol(math, bin, "\u2A62", "\\doublebarvee", true);
1284
+ defineSymbol(math, bin, "\u2A63", "\\veedoublebar", true);
1285
+ defineSymbol(math, bin, "\u2A5F", "\\wedgebar", true);
1286
+ defineSymbol(math, bin, "\u2A60", "\\wedgedoublebar", true);
1287
+ defineSymbol(math, bin, "\u2A54", "\\Vee", true);
1288
+ defineSymbol(math, bin, "\u2A53", "\\Wedge", true);
1289
+ defineSymbol(math, bin, "\u2A43", "\\barcap", true);
1290
+ defineSymbol(math, bin, "\u2A42", "\\barcup", true);
1291
+ defineSymbol(math, bin, "\u2A48", "\\capbarcup", true);
1292
+ defineSymbol(math, bin, "\u2A40", "\\capdot", true);
1293
+ defineSymbol(math, bin, "\u2A47", "\\capovercup", true);
1294
+ defineSymbol(math, bin, "\u2A46", "\\cupovercap", true);
1295
+ defineSymbol(math, bin, "\u2A4D", "\\closedvarcap", true);
1296
+ defineSymbol(math, bin, "\u2A4C", "\\closedvarcup", true);
1297
+ defineSymbol(math, bin, "\u2A2A", "\\minusdot", true);
1298
+ defineSymbol(math, bin, "\u2A2B", "\\minusfdots", true);
1299
+ defineSymbol(math, bin, "\u2A2C", "\\minusrdots", true);
1300
+ defineSymbol(math, bin, "\u22BB", "\\Xor", true);
1301
+ defineSymbol(math, bin, "\u22BC", "\\Nand", true);
1302
+ defineSymbol(math, bin, "\u22BD", "\\Nor", true);
1303
+ defineSymbol(math, bin, "\u22BD", "\\barvee");
1304
+ defineSymbol(math, bin, "\u2AF4", "\\interleave", true);
1305
+ defineSymbol(math, bin, "\u29E2", "\\shuffle", true);
1306
+ defineSymbol(math, bin, "\u2AF6", "\\threedotcolon", true);
1307
+ defineSymbol(math, bin, "\u2982", "\\typecolon", true);
1308
+ defineSymbol(math, bin, "\u223E", "\\invlazys", true);
1309
+ defineSymbol(math, bin, "\u2A4B", "\\twocaps", true);
1310
+ defineSymbol(math, bin, "\u2A4A", "\\twocups", true);
1311
+ defineSymbol(math, bin, "\u2A4E", "\\Sqcap", true);
1312
+ defineSymbol(math, bin, "\u2A4F", "\\Sqcup", true);
1313
+ defineSymbol(math, bin, "\u2A56", "\\veeonvee", true);
1314
+ defineSymbol(math, bin, "\u2A55", "\\wedgeonwedge", true);
1315
+ defineSymbol(math, bin, "\u29D7", "\\blackhourglass", true);
1316
+ defineSymbol(math, bin, "\u29C6", "\\boxast", true);
1317
+ defineSymbol(math, bin, "\u29C8", "\\boxbox", true);
1318
+ defineSymbol(math, bin, "\u29C7", "\\boxcircle", true);
1319
+ defineSymbol(math, bin, "\u229C", "\\circledequal", true);
1320
+ defineSymbol(math, bin, "\u29B7", "\\circledparallel", true);
1321
+ defineSymbol(math, bin, "\u29B6", "\\circledvert", true);
1322
+ defineSymbol(math, bin, "\u29B5", "\\circlehbar", true);
1323
+ defineSymbol(math, bin, "\u27E1", "\\concavediamond", true);
1324
+ defineSymbol(math, bin, "\u27E2", "\\concavediamondtickleft", true);
1325
+ defineSymbol(math, bin, "\u27E3", "\\concavediamondtickright", true);
1326
+ defineSymbol(math, bin, "\u22C4", "\\diamond", true);
1327
+ defineSymbol(math, bin, "\u29D6", "\\hourglass", true);
1328
+ defineSymbol(math, bin, "\u27E0", "\\lozengeminus", true);
1329
+ defineSymbol(math, bin, "\u233D", "\\obar", true);
1330
+ defineSymbol(math, bin, "\u29B8", "\\obslash", true);
1331
+ defineSymbol(math, bin, "\u2A38", "\\odiv", true);
1332
+ defineSymbol(math, bin, "\u29C1", "\\ogreaterthan", true);
1333
+ defineSymbol(math, bin, "\u29C0", "\\olessthan", true);
1334
+ defineSymbol(math, bin, "\u29B9", "\\operp", true);
1335
+ defineSymbol(math, bin, "\u2A37", "\\Otimes", true);
1336
+ defineSymbol(math, bin, "\u2A36", "\\otimeshat", true);
1337
+ defineSymbol(math, bin, "\u22C6", "\\star", true);
1338
+ defineSymbol(math, bin, "\u25B3", "\\triangle", true);
1339
+ defineSymbol(math, bin, "\u2A3A", "\\triangleminus", true);
1340
+ defineSymbol(math, bin, "\u2A39", "\\triangleplus", true);
1341
+ defineSymbol(math, bin, "\u2A3B", "\\triangletimes", true);
1342
+ defineSymbol(math, bin, "\u27E4", "\\whitesquaretickleft", true);
1343
+ defineSymbol(math, bin, "\u27E5", "\\whitesquaretickright", true);
1344
+ defineSymbol(math, bin, "\u2A33", "\\smashtimes", true);
1258
1345
 
1259
1346
  // AMS Arrows
1260
1347
  // Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
@@ -1496,8 +1583,8 @@ defineSymbol(math, spacing, null, "\\allowbreak");
1496
1583
  defineSymbol(math, punct, ",", ",");
1497
1584
  defineSymbol(text, punct, ":", ":");
1498
1585
  defineSymbol(math, punct, ";", ";");
1499
- defineSymbol(math, bin, "\u22bc", "\\barwedge", true);
1500
- defineSymbol(math, bin, "\u22bb", "\\veebar", true);
1586
+ defineSymbol(math, bin, "\u22bc", "\\barwedge");
1587
+ defineSymbol(math, bin, "\u22bb", "\\veebar");
1501
1588
  defineSymbol(math, bin, "\u2299", "\\odot", true);
1502
1589
  // Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
1503
1590
  defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
@@ -1510,7 +1597,6 @@ defineSymbol(math, bin, "\u25b3", "\\bigtriangleup");
1510
1597
  defineSymbol(math, bin, "\u25bd", "\\bigtriangledown");
1511
1598
  defineSymbol(math, bin, "\u2020", "\\dagger");
1512
1599
  defineSymbol(math, bin, "\u22c4", "\\diamond");
1513
- defineSymbol(math, bin, "\u22c6", "\\star");
1514
1600
  defineSymbol(math, bin, "\u25c3", "\\triangleleft");
1515
1601
  defineSymbol(math, bin, "\u25b9", "\\triangleright");
1516
1602
  defineSymbol(math, open, "{", "\\{");
@@ -3485,6 +3571,9 @@ defineFunction({
3485
3571
 
3486
3572
  if (funcName === "\\edef" || funcName === "\\xdef") {
3487
3573
  tokens = parser.gullet.expandTokens(tokens);
3574
+ if (tokens.length > parser.gullet.settings.maxExpand) {
3575
+ throw new ParseError("Too many expansions in an " + funcName);
3576
+ }
3488
3577
  tokens.reverse(); // to fit in with stack order
3489
3578
  }
3490
3579
  // Final arg is the expansion of the macro
@@ -13223,7 +13312,7 @@ class Style {
13223
13312
  * https://mit-license.org/
13224
13313
  */
13225
13314
 
13226
- const version = "0.10.23";
13315
+ const version = "0.10.24";
13227
13316
 
13228
13317
  function postProcess(block) {
13229
13318
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -147,11 +147,29 @@ var temml = (function () {
147
147
 
148
148
  /**
149
149
  * Return the protocol of a URL, or "_relative" if the URL does not specify a
150
- * protocol (and thus is relative).
150
+ * protocol (and thus is relative), or `null` if URL has invalid protocol
151
+ * (so should be outright rejected).
151
152
  */
152
153
  const protocolFromUrl = function(url) {
153
- const protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
154
- return protocol != null ? protocol[1] : "_relative";
154
+ // Check for possible leading protocol.
155
+ // https://url.spec.whatwg.org/#url-parsing strips leading whitespace
156
+ // (\x00) or C0 control (\x00-\x1F) characters.
157
+ // eslint-disable-next-line no-control-regex
158
+ const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(url);
159
+ if (!protocol) {
160
+ return "_relative";
161
+ }
162
+ // Reject weird colons
163
+ if (protocol[2] !== ":") {
164
+ return null;
165
+ }
166
+ // Reject invalid characters in scheme according to
167
+ // https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
168
+ if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
169
+ return null;
170
+ }
171
+ // Lowercase the protocol
172
+ return protocol[1].toLowerCase();
155
173
  };
156
174
 
157
175
  /**
@@ -216,7 +234,11 @@ var temml = (function () {
216
234
  */
217
235
  isTrusted(context) {
218
236
  if (context.url && !context.protocol) {
219
- context.protocol = utils.protocolFromUrl(context.url);
237
+ const protocol = utils.protocolFromUrl(context.url);
238
+ if (protocol == null) {
239
+ return false
240
+ }
241
+ context.protocol = protocol;
220
242
  }
221
243
  const trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
222
244
  return Boolean(trust);
@@ -1255,7 +1277,72 @@ var temml = (function () {
1255
1277
  defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
1256
1278
  defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
1257
1279
 
1258
- defineSymbol(math, bin, "\u2238", "\\dotminus", true); // stix
1280
+ // stix Binary Operators
1281
+ defineSymbol(math, bin, "\u2238", "\\dotminus", true);
1282
+ defineSymbol(math, bin, "\u27D1", "\\wedgedot", true);
1283
+ defineSymbol(math, bin, "\u27C7", "\\veedot", true);
1284
+ defineSymbol(math, bin, "\u2A62", "\\doublebarvee", true);
1285
+ defineSymbol(math, bin, "\u2A63", "\\veedoublebar", true);
1286
+ defineSymbol(math, bin, "\u2A5F", "\\wedgebar", true);
1287
+ defineSymbol(math, bin, "\u2A60", "\\wedgedoublebar", true);
1288
+ defineSymbol(math, bin, "\u2A54", "\\Vee", true);
1289
+ defineSymbol(math, bin, "\u2A53", "\\Wedge", true);
1290
+ defineSymbol(math, bin, "\u2A43", "\\barcap", true);
1291
+ defineSymbol(math, bin, "\u2A42", "\\barcup", true);
1292
+ defineSymbol(math, bin, "\u2A48", "\\capbarcup", true);
1293
+ defineSymbol(math, bin, "\u2A40", "\\capdot", true);
1294
+ defineSymbol(math, bin, "\u2A47", "\\capovercup", true);
1295
+ defineSymbol(math, bin, "\u2A46", "\\cupovercap", true);
1296
+ defineSymbol(math, bin, "\u2A4D", "\\closedvarcap", true);
1297
+ defineSymbol(math, bin, "\u2A4C", "\\closedvarcup", true);
1298
+ defineSymbol(math, bin, "\u2A2A", "\\minusdot", true);
1299
+ defineSymbol(math, bin, "\u2A2B", "\\minusfdots", true);
1300
+ defineSymbol(math, bin, "\u2A2C", "\\minusrdots", true);
1301
+ defineSymbol(math, bin, "\u22BB", "\\Xor", true);
1302
+ defineSymbol(math, bin, "\u22BC", "\\Nand", true);
1303
+ defineSymbol(math, bin, "\u22BD", "\\Nor", true);
1304
+ defineSymbol(math, bin, "\u22BD", "\\barvee");
1305
+ defineSymbol(math, bin, "\u2AF4", "\\interleave", true);
1306
+ defineSymbol(math, bin, "\u29E2", "\\shuffle", true);
1307
+ defineSymbol(math, bin, "\u2AF6", "\\threedotcolon", true);
1308
+ defineSymbol(math, bin, "\u2982", "\\typecolon", true);
1309
+ defineSymbol(math, bin, "\u223E", "\\invlazys", true);
1310
+ defineSymbol(math, bin, "\u2A4B", "\\twocaps", true);
1311
+ defineSymbol(math, bin, "\u2A4A", "\\twocups", true);
1312
+ defineSymbol(math, bin, "\u2A4E", "\\Sqcap", true);
1313
+ defineSymbol(math, bin, "\u2A4F", "\\Sqcup", true);
1314
+ defineSymbol(math, bin, "\u2A56", "\\veeonvee", true);
1315
+ defineSymbol(math, bin, "\u2A55", "\\wedgeonwedge", true);
1316
+ defineSymbol(math, bin, "\u29D7", "\\blackhourglass", true);
1317
+ defineSymbol(math, bin, "\u29C6", "\\boxast", true);
1318
+ defineSymbol(math, bin, "\u29C8", "\\boxbox", true);
1319
+ defineSymbol(math, bin, "\u29C7", "\\boxcircle", true);
1320
+ defineSymbol(math, bin, "\u229C", "\\circledequal", true);
1321
+ defineSymbol(math, bin, "\u29B7", "\\circledparallel", true);
1322
+ defineSymbol(math, bin, "\u29B6", "\\circledvert", true);
1323
+ defineSymbol(math, bin, "\u29B5", "\\circlehbar", true);
1324
+ defineSymbol(math, bin, "\u27E1", "\\concavediamond", true);
1325
+ defineSymbol(math, bin, "\u27E2", "\\concavediamondtickleft", true);
1326
+ defineSymbol(math, bin, "\u27E3", "\\concavediamondtickright", true);
1327
+ defineSymbol(math, bin, "\u22C4", "\\diamond", true);
1328
+ defineSymbol(math, bin, "\u29D6", "\\hourglass", true);
1329
+ defineSymbol(math, bin, "\u27E0", "\\lozengeminus", true);
1330
+ defineSymbol(math, bin, "\u233D", "\\obar", true);
1331
+ defineSymbol(math, bin, "\u29B8", "\\obslash", true);
1332
+ defineSymbol(math, bin, "\u2A38", "\\odiv", true);
1333
+ defineSymbol(math, bin, "\u29C1", "\\ogreaterthan", true);
1334
+ defineSymbol(math, bin, "\u29C0", "\\olessthan", true);
1335
+ defineSymbol(math, bin, "\u29B9", "\\operp", true);
1336
+ defineSymbol(math, bin, "\u2A37", "\\Otimes", true);
1337
+ defineSymbol(math, bin, "\u2A36", "\\otimeshat", true);
1338
+ defineSymbol(math, bin, "\u22C6", "\\star", true);
1339
+ defineSymbol(math, bin, "\u25B3", "\\triangle", true);
1340
+ defineSymbol(math, bin, "\u2A3A", "\\triangleminus", true);
1341
+ defineSymbol(math, bin, "\u2A39", "\\triangleplus", true);
1342
+ defineSymbol(math, bin, "\u2A3B", "\\triangletimes", true);
1343
+ defineSymbol(math, bin, "\u27E4", "\\whitesquaretickleft", true);
1344
+ defineSymbol(math, bin, "\u27E5", "\\whitesquaretickright", true);
1345
+ defineSymbol(math, bin, "\u2A33", "\\smashtimes", true);
1259
1346
 
1260
1347
  // AMS Arrows
1261
1348
  // Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
@@ -1497,8 +1584,8 @@ var temml = (function () {
1497
1584
  defineSymbol(math, punct, ",", ",");
1498
1585
  defineSymbol(text, punct, ":", ":");
1499
1586
  defineSymbol(math, punct, ";", ";");
1500
- defineSymbol(math, bin, "\u22bc", "\\barwedge", true);
1501
- defineSymbol(math, bin, "\u22bb", "\\veebar", true);
1587
+ defineSymbol(math, bin, "\u22bc", "\\barwedge");
1588
+ defineSymbol(math, bin, "\u22bb", "\\veebar");
1502
1589
  defineSymbol(math, bin, "\u2299", "\\odot", true);
1503
1590
  // Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
1504
1591
  defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
@@ -1511,7 +1598,6 @@ var temml = (function () {
1511
1598
  defineSymbol(math, bin, "\u25bd", "\\bigtriangledown");
1512
1599
  defineSymbol(math, bin, "\u2020", "\\dagger");
1513
1600
  defineSymbol(math, bin, "\u22c4", "\\diamond");
1514
- defineSymbol(math, bin, "\u22c6", "\\star");
1515
1601
  defineSymbol(math, bin, "\u25c3", "\\triangleleft");
1516
1602
  defineSymbol(math, bin, "\u25b9", "\\triangleright");
1517
1603
  defineSymbol(math, open, "{", "\\{");
@@ -3486,6 +3572,9 @@ var temml = (function () {
3486
3572
 
3487
3573
  if (funcName === "\\edef" || funcName === "\\xdef") {
3488
3574
  tokens = parser.gullet.expandTokens(tokens);
3575
+ if (tokens.length > parser.gullet.settings.maxExpand) {
3576
+ throw new ParseError("Too many expansions in an " + funcName);
3577
+ }
3489
3578
  tokens.reverse(); // to fit in with stack order
3490
3579
  }
3491
3580
  // Final arg is the expansion of the macro
@@ -11324,7 +11413,7 @@ var temml = (function () {
11324
11413
  * https://mit-license.org/
11325
11414
  */
11326
11415
 
11327
- const version = "0.10.23";
11416
+ const version = "0.10.24";
11328
11417
 
11329
11418
  function postProcess(block) {
11330
11419
  const labelMap = {};