@readme/markdown 9.3.1 → 9.3.3

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/489.node.js CHANGED
@@ -9,6 +9,7 @@ exports.modules = {
9
9
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
10
  /* harmony export */ "default": () => (/* binding */ katex)
11
11
  /* harmony export */ });
12
+ /* unused harmony exports ParseError, SETTINGS_SCHEMA, __defineFunction, __defineMacro, __defineSymbol, __domTree, __parse, __renderToDomTree, __renderToHTMLTree, __setFontMetrics, render, renderToString, version */
12
13
  /**
13
14
  * Lexing or parsing positional information for error reporting.
14
15
  * This object is immutable.
@@ -3953,10 +3954,20 @@ var toNode = function toNode(tagName) {
3953
3954
  return node;
3954
3955
  };
3955
3956
  /**
3956
- * Convert into an HTML markup string
3957
+ * https://w3c.github.io/html-reference/syntax.html#syntax-attributes
3958
+ *
3959
+ * > Attribute Names must consist of one or more characters
3960
+ * other than the space characters, U+0000 NULL,
3961
+ * '"', "'", ">", "/", "=", the control characters,
3962
+ * and any characters that are not defined by Unicode.
3957
3963
  */
3958
3964
 
3959
3965
 
3966
+ var invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/;
3967
+ /**
3968
+ * Convert into an HTML markup string
3969
+ */
3970
+
3960
3971
  var toMarkup = function toMarkup(tagName) {
3961
3972
  var markup = "<" + tagName; // Add the class
3962
3973
 
@@ -3979,6 +3990,10 @@ var toMarkup = function toMarkup(tagName) {
3979
3990
 
3980
3991
  for (var attr in this.attributes) {
3981
3992
  if (this.attributes.hasOwnProperty(attr)) {
3993
+ if (invalidAttributeNameRegex.test(attr)) {
3994
+ throw new ParseError("Invalid attribute name '" + attr + "'");
3995
+ }
3996
+
3982
3997
  markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
3983
3998
  }
3984
3999
  }
@@ -5049,9 +5064,10 @@ defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
5049
5064
  defineSymbol(text, main, inner, "\u2026", "\\ldots", true);
5050
5065
  defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
5051
5066
  defineSymbol(math, main, inner, "\u22ef", "\\@cdots", true);
5052
- defineSymbol(math, main, inner, "\u22f1", "\\ddots", true);
5053
- defineSymbol(math, main, textord, "\u22ee", "\\varvdots"); // \vdots is a macro
5067
+ defineSymbol(math, main, inner, "\u22f1", "\\ddots", true); // \vdots is a macro that uses one of these two symbols (with made-up names):
5054
5068
 
5069
+ defineSymbol(math, main, textord, "\u22ee", "\\varvdots");
5070
+ defineSymbol(text, main, textord, "\u22ee", "\\varvdots");
5055
5071
  defineSymbol(math, main, accent, "\u02ca", "\\acute");
5056
5072
  defineSymbol(math, main, accent, "\u02cb", "\\grave");
5057
5073
  defineSymbol(math, main, accent, "\u00a8", "\\ddot");
@@ -5097,7 +5113,7 @@ defineSymbol(text, main, accent, "\u02da", "\\r"); // ring above
5097
5113
 
5098
5114
  defineSymbol(text, main, accent, "\u02c7", "\\v"); // caron
5099
5115
 
5100
- defineSymbol(text, main, accent, "\u00a8", '\\"'); // diaresis
5116
+ defineSymbol(text, main, accent, "\u00a8", '\\"'); // diaeresis
5101
5117
 
5102
5118
  defineSymbol(text, main, accent, "\u02dd", "\\H"); // double acute
5103
5119
 
@@ -5970,6 +5986,10 @@ var fontMap = {
5970
5986
  variant: "italic",
5971
5987
  fontName: "Math-Italic"
5972
5988
  },
5989
+ "mathsfit": {
5990
+ variant: "sans-serif-italic",
5991
+ fontName: "SansSerif-Italic"
5992
+ },
5973
5993
  // "boldsymbol" is missing because they require the use of multiple fonts:
5974
5994
  // Math-BoldItalic and Main-Bold. This is handled by a special case in
5975
5995
  // makeOrd which ends up calling boldsymbol.
@@ -6683,7 +6703,19 @@ class MathNode {
6683
6703
  }
6684
6704
 
6685
6705
  for (var i = 0; i < this.children.length; i++) {
6686
- node.appendChild(this.children[i].toNode());
6706
+ // Combine multiple TextNodes into one TextNode, to prevent
6707
+ // screen readers from reading each as a separate word [#3995]
6708
+ if (this.children[i] instanceof TextNode && this.children[i + 1] instanceof TextNode) {
6709
+ var text = this.children[i].toText() + this.children[++i].toText();
6710
+
6711
+ while (this.children[i + 1] instanceof TextNode) {
6712
+ text += this.children[++i].toText();
6713
+ }
6714
+
6715
+ node.appendChild(new TextNode(text).toNode());
6716
+ } else {
6717
+ node.appendChild(this.children[i].toNode());
6718
+ }
6687
6719
  }
6688
6720
 
6689
6721
  return node;
@@ -6922,6 +6954,8 @@ var getVariant = function getVariant(group, options) {
6922
6954
  return "bold";
6923
6955
  } else if (font === "mathbb") {
6924
6956
  return "double-struck";
6957
+ } else if (font === "mathsfit") {
6958
+ return "sans-serif-italic";
6925
6959
  } else if (font === "mathfrak") {
6926
6960
  return "fraktur";
6927
6961
  } else if (font === "mathscr" || font === "mathcal") {
@@ -6951,12 +6985,34 @@ var getVariant = function getVariant(group, options) {
6951
6985
 
6952
6986
  return null;
6953
6987
  };
6988
+ /**
6989
+ * Check for <mi>.</mi> which is how a dot renders in MathML,
6990
+ * or <mo separator="true" lspace="0em" rspace="0em">,</mo>
6991
+ * which is how a braced comma {,} renders in MathML
6992
+ */
6993
+
6994
+ function isNumberPunctuation(group) {
6995
+ if (!group) {
6996
+ return false;
6997
+ }
6998
+
6999
+ if (group.type === 'mi' && group.children.length === 1) {
7000
+ var child = group.children[0];
7001
+ return child instanceof TextNode && child.text === '.';
7002
+ } else if (group.type === 'mo' && group.children.length === 1 && group.getAttribute('separator') === 'true' && group.getAttribute('lspace') === '0em' && group.getAttribute('rspace') === '0em') {
7003
+ var _child = group.children[0];
7004
+ return _child instanceof TextNode && _child.text === ',';
7005
+ } else {
7006
+ return false;
7007
+ }
7008
+ }
6954
7009
  /**
6955
7010
  * Takes a list of nodes, builds them, and returns a list of the generated
6956
7011
  * MathML nodes. Also combine consecutive <mtext> outputs into a single
6957
7012
  * <mtext> tag.
6958
7013
  */
6959
7014
 
7015
+
6960
7016
  var buildExpression = function buildExpression(expression, options, isOrdgroup) {
6961
7017
  if (expression.length === 1) {
6962
7018
  var group = buildGroup(expression[0], options);
@@ -6985,22 +7041,30 @@ var buildExpression = function buildExpression(expression, options, isOrdgroup)
6985
7041
  } else if (_group.type === 'mn' && lastGroup.type === 'mn') {
6986
7042
  lastGroup.children.push(..._group.children);
6987
7043
  continue; // Concatenate <mn>...</mn> followed by <mi>.</mi>
6988
- } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') {
6989
- var child = _group.children[0];
7044
+ } else if (isNumberPunctuation(_group) && lastGroup.type === 'mn') {
7045
+ lastGroup.children.push(..._group.children);
7046
+ continue; // Concatenate <mi>.</mi> followed by <mn>...</mn>
7047
+ } else if (_group.type === 'mn' && isNumberPunctuation(lastGroup)) {
7048
+ _group.children = [...lastGroup.children, ..._group.children];
7049
+ groups.pop(); // Put preceding <mn>...</mn> or <mi>.</mi> inside base of
7050
+ // <msup><mn>...base...</mn>...exponent...</msup> (or <msub>)
7051
+ } else if ((_group.type === 'msup' || _group.type === 'msub') && _group.children.length >= 1 && (lastGroup.type === 'mn' || isNumberPunctuation(lastGroup))) {
7052
+ var base = _group.children[0];
7053
+
7054
+ if (base instanceof MathNode && base.type === 'mn') {
7055
+ base.children = [...lastGroup.children, ...base.children];
7056
+ groups.pop();
7057
+ } // \not
6990
7058
 
6991
- if (child instanceof TextNode && child.text === '.') {
6992
- lastGroup.children.push(..._group.children);
6993
- continue;
6994
- }
6995
7059
  } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
6996
7060
  var lastChild = lastGroup.children[0];
6997
7061
 
6998
7062
  if (lastChild instanceof TextNode && lastChild.text === '\u0338' && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) {
6999
- var _child = _group.children[0];
7063
+ var child = _group.children[0];
7000
7064
 
7001
- if (_child instanceof TextNode && _child.text.length > 0) {
7065
+ if (child instanceof TextNode && child.text.length > 0) {
7002
7066
  // Overlay with combining character long solidus
7003
- _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1);
7067
+ child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1);
7004
7068
  groups.pop();
7005
7069
  }
7006
7070
  }
@@ -11566,7 +11630,7 @@ var fontAliases = {
11566
11630
  defineFunction({
11567
11631
  type: "font",
11568
11632
  names: [// styles, except \boldsymbol defined below
11569
- "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families
11633
+ "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", "\\mathsfit", // families
11570
11634
  "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below
11571
11635
  "\\Bbb", "\\bold", "\\frak"],
11572
11636
  props: {
@@ -13800,7 +13864,8 @@ defineFunction({
13800
13864
  names: ["\\relax"],
13801
13865
  props: {
13802
13866
  numArgs: 0,
13803
- allowedInText: true
13867
+ allowedInText: true,
13868
+ allowedInArgument: true
13804
13869
  },
13805
13870
 
13806
13871
  handler(_ref) {
@@ -13821,6 +13886,8 @@ defineFunction({
13821
13886
  props: {
13822
13887
  numArgs: 2,
13823
13888
  numOptionalArgs: 1,
13889
+ allowedInText: true,
13890
+ allowedInMath: true,
13824
13891
  argTypes: ["size", "size", "size"]
13825
13892
  },
13826
13893
 
@@ -14424,7 +14491,7 @@ defineFunctionBuilders({
14424
14491
  },
14425
14492
 
14426
14493
  mathmlBuilder(group, options) {
14427
- // Is the inner group a relevant horizonal brace?
14494
+ // Is the inner group a relevant horizontal brace?
14428
14495
  var isBrace = false;
14429
14496
  var isOver;
14430
14497
  var isSup;
@@ -15335,7 +15402,7 @@ defineMacro("\\char", function (context) {
15335
15402
  // \renewcommand{\macro}[args]{definition}
15336
15403
  // TODO: Optional arguments: \newcommand{\macro}[args][default]{definition}
15337
15404
 
15338
- var newcommand = (context, existsOK, nonexistsOK) => {
15405
+ var newcommand = (context, existsOK, nonexistsOK, skipIfExists) => {
15339
15406
  var arg = context.consumeArg().tokens;
15340
15407
 
15341
15408
  if (arg.length !== 1) {
@@ -15372,19 +15439,22 @@ var newcommand = (context, existsOK, nonexistsOK) => {
15372
15439
 
15373
15440
  numArgs = parseInt(argText);
15374
15441
  arg = context.consumeArg().tokens;
15375
- } // Final arg is the expansion of the macro
15442
+ }
15376
15443
 
15444
+ if (!(exists && skipIfExists)) {
15445
+ // Final arg is the expansion of the macro
15446
+ context.macros.set(name, {
15447
+ tokens: arg,
15448
+ numArgs
15449
+ });
15450
+ }
15377
15451
 
15378
- context.macros.set(name, {
15379
- tokens: arg,
15380
- numArgs
15381
- });
15382
15452
  return '';
15383
15453
  };
15384
15454
 
15385
- defineMacro("\\newcommand", context => newcommand(context, false, true));
15386
- defineMacro("\\renewcommand", context => newcommand(context, true, false));
15387
- defineMacro("\\providecommand", context => newcommand(context, true, true)); // terminal (console) tools
15455
+ defineMacro("\\newcommand", context => newcommand(context, false, true, false));
15456
+ defineMacro("\\renewcommand", context => newcommand(context, true, false, false));
15457
+ defineMacro("\\providecommand", context => newcommand(context, true, true, true)); // terminal (console) tools
15388
15458
 
15389
15459
  defineMacro("\\message", context => {
15390
15460
  var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console
@@ -15505,7 +15575,7 @@ defineMacro("\\lrcorner", "\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}");
15505
15575
  // We'll call \varvdots, which gets a glyph from symbols.js.
15506
15576
  // The zero-width rule gets us an equivalent to the vertical 6pt kern.
15507
15577
 
15508
- defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}");
15578
+ defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
15509
15579
  defineMacro("\u22ee", "\\vdots"); //////////////////////////////////////////////////////////////////////
15510
15580
  // amsmath.sty
15511
15581
  // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf
@@ -15535,7 +15605,12 @@ defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Lon
15535
15605
 
15536
15606
  defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
15537
15607
  defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
15538
- defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro.
15608
+ defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // \def\dddot#1{{\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
15609
+ // \hbox{\normalfont ...}\vss}}}}
15610
+ // We use \overset which avoids the vertical shift of \mathop.
15611
+
15612
+ defineMacro("\\dddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");
15613
+ defineMacro("\\ddddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}"); // AMSMath's automatic \dots, based on \mdots@@ macro.
15539
15614
 
15540
15615
  var dotsByToken = {
15541
15616
  ',': '\\dotsc',
@@ -17325,6 +17400,7 @@ class Parser {
17325
17400
  if (!atom) {
17326
17401
  break;
17327
17402
  } else if (atom.type === "internal") {
17403
+ // Internal nodes do not appear in parse tree
17328
17404
  continue;
17329
17405
  }
17330
17406
 
@@ -17411,8 +17487,15 @@ class Parser {
17411
17487
  var symbol = symbolToken.text;
17412
17488
  this.consume();
17413
17489
  this.consumeSpaces(); // ignore spaces before sup/subscript argument
17490
+ // Skip over allowed internal nodes such as \relax
17491
+
17492
+ var group;
17493
+
17494
+ do {
17495
+ var _group;
17414
17496
 
17415
- var group = this.parseGroup(name);
17497
+ group = this.parseGroup(name);
17498
+ } while (((_group = group) == null ? void 0 : _group.type) === "internal");
17416
17499
 
17417
17500
  if (!group) {
17418
17501
  throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
@@ -17458,7 +17541,13 @@ class Parser {
17458
17541
  parseAtom(breakOnTokenText) {
17459
17542
  // The body of an atom is an implicit group, so that things like
17460
17543
  // \left(x\right)^2 work correctly.
17461
- var base = this.parseGroup("atom", breakOnTokenText); // In text mode, we don't have superscripts or subscripts
17544
+ var base = this.parseGroup("atom", breakOnTokenText); // Internal nodes (e.g. \relax) cannot support super/subscripts.
17545
+ // Instead we will pick up super/subscripts with blank base next round.
17546
+
17547
+ if ((base == null ? void 0 : base.type) === "internal") {
17548
+ return base;
17549
+ } // In text mode, we don't have superscripts or subscripts
17550
+
17462
17551
 
17463
17552
  if (this.mode === "text") {
17464
17553
  return base;
@@ -17745,13 +17834,13 @@ class Parser {
17745
17834
  throw new ParseError("A primitive argument cannot be optional");
17746
17835
  }
17747
17836
 
17748
- var _group = this.parseGroup(name);
17837
+ var _group2 = this.parseGroup(name);
17749
17838
 
17750
- if (_group == null) {
17839
+ if (_group2 == null) {
17751
17840
  throw new ParseError("Expected group as " + name, this.fetch());
17752
17841
  }
17753
17842
 
17754
- return _group;
17843
+ return _group2;
17755
17844
  }
17756
17845
 
17757
17846
  case "original":
@@ -18368,11 +18457,21 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
18368
18457
  }
18369
18458
  };
18370
18459
 
18460
+ var version = "0.16.22";
18461
+ var __domTree = {
18462
+ Span,
18463
+ Anchor,
18464
+ SymbolNode,
18465
+ SvgNode,
18466
+ PathNode,
18467
+ LineNode
18468
+ }; // ESM exports
18469
+
18371
18470
  var katex = {
18372
18471
  /**
18373
18472
  * Current KaTeX version
18374
18473
  */
18375
- version: "0.16.11",
18474
+ version,
18376
18475
 
18377
18476
  /**
18378
18477
  * Renders the given LaTeX into an HTML+MathML combination, and adds
@@ -18392,7 +18491,7 @@ var katex = {
18392
18491
  ParseError,
18393
18492
 
18394
18493
  /**
18395
- * The shema of Settings
18494
+ * The schema of Settings
18396
18495
  */
18397
18496
  SETTINGS_SCHEMA,
18398
18497
 
@@ -18452,18 +18551,11 @@ var katex = {
18452
18551
  /**
18453
18552
  * Expose the dom tree node types, which can be useful for type checking nodes.
18454
18553
  *
18455
- * NOTE: This method is not currently recommended for public use.
18554
+ * NOTE: These methods are not currently recommended for public use.
18456
18555
  * The internal tree representation is unstable and is very likely
18457
18556
  * to change. Use at your own risk.
18458
18557
  */
18459
- __domTree: {
18460
- Span,
18461
- Anchor,
18462
- SymbolNode,
18463
- SvgNode,
18464
- PathNode,
18465
- LineNode
18466
- }
18558
+ __domTree
18467
18559
  };
18468
18560
 
18469
18561