katex 0.17.0 → 0.18.0

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.
Files changed (49) hide show
  1. package/README.md +3 -3
  2. package/cli.js +6 -9
  3. package/contrib/auto-render/index.html +1 -1
  4. package/contrib/copy-tex/README.md +3 -3
  5. package/contrib/copy-tex/index.html +1 -1
  6. package/contrib/mathtex-script-type/README.md +5 -5
  7. package/contrib/mhchem/README.md +1 -1
  8. package/dist/README.md +3 -3
  9. package/dist/contrib/render-a11y-string.js +15 -40
  10. package/dist/contrib/render-a11y-string.min.js +1 -1
  11. package/dist/contrib/render-a11y-string.mjs +13 -33
  12. package/dist/katex-swap.css +159 -164
  13. package/dist/katex-swap.min.css +1 -1
  14. package/dist/katex.css +159 -164
  15. package/dist/katex.js +259 -420
  16. package/dist/katex.min.css +1 -1
  17. package/dist/katex.min.js +1 -1
  18. package/dist/katex.mjs +259 -420
  19. package/package.json +12 -16
  20. package/src/MacroExpander.ts +10 -7
  21. package/src/Namespace.ts +16 -20
  22. package/src/Options.ts +2 -2
  23. package/src/Parser.ts +2 -2
  24. package/src/atoms.ts +22 -22
  25. package/src/buildCommon.ts +2 -2
  26. package/src/buildHTML.ts +8 -8
  27. package/src/buildMathML.ts +3 -3
  28. package/src/environments/array.ts +3 -3
  29. package/src/fontMetrics.ts +2 -4
  30. package/src/functions/accent.ts +2 -2
  31. package/src/functions/cr.ts +1 -1
  32. package/src/functions/enclose.ts +1 -1
  33. package/src/functions/environment.ts +1 -1
  34. package/src/functions/html.ts +3 -3
  35. package/src/functions/lap.ts +7 -7
  36. package/src/functions/overline.ts +1 -1
  37. package/src/functions/phantom.ts +2 -2
  38. package/src/functions/rule.ts +1 -1
  39. package/src/functions/sizing.ts +1 -1
  40. package/src/functions/smash.ts +1 -1
  41. package/src/functions/sqrt.ts +1 -1
  42. package/src/functions/symbolsSpacing.ts +20 -21
  43. package/src/functions/underline.ts +1 -1
  44. package/src/macros.ts +3 -3
  45. package/src/mathMLTree.ts +6 -10
  46. package/src/parseNode.ts +4 -4
  47. package/src/stretchy.ts +2 -2
  48. package/src/styles/katex.scss +31 -37
  49. package/src/wide-character.ts +2 -2
package/dist/katex.mjs CHANGED
@@ -3732,10 +3732,8 @@ function getGlobalMetrics(size) {
3732
3732
  var metrics = fontMetricsBySizeIndex[sizeIndex] = {
3733
3733
  cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
3734
3734
  };
3735
- for (var key in sigmasAndXis) {
3736
- if (sigmasAndXis.hasOwnProperty(key)) {
3737
- metrics[key] = sigmasAndXis[key][sizeIndex];
3738
- }
3735
+ for (var key of Object.keys(sigmasAndXis)) {
3736
+ metrics[key] = sigmasAndXis[key][sizeIndex];
3739
3737
  }
3740
3738
  }
3741
3739
  return fontMetricsBySizeIndex[sizeIndex];
@@ -4803,12 +4801,10 @@ var makeOrd = function makeOrd(group, options) {
4803
4801
  var mode = group.mode;
4804
4802
  var text = group.text;
4805
4803
  var classes = ["mord"];
4806
- var {
4807
- font,
4808
- fontFamily,
4809
- fontWeight,
4810
- fontShape
4811
- } = options;
4804
+ var font = options.font,
4805
+ fontFamily = options.fontFamily,
4806
+ fontWeight = options.fontWeight,
4807
+ fontShape = options.fontShape;
4812
4808
  // Math mode or Old font (i.e. \rm)
4813
4809
  var useFont = mode === "math" || mode === "text" && !!font;
4814
4810
  var fontOrFamily = useFont ? font : fontFamily;
@@ -4838,7 +4834,7 @@ var makeOrd = function makeOrd(group, options) {
4838
4834
  }
4839
4835
  if (lookupSymbol(text, fontName, mode).metrics) {
4840
4836
  return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));
4841
- } else if (ligatures.hasOwnProperty(text) && fontName.slice(0, 10) === "Typewriter") {
4837
+ } else if (Object.prototype.hasOwnProperty.call(ligatures, text) && fontName.slice(0, 10) === "Typewriter") {
4842
4838
  // Deconstruct ligatures in monospace fonts (\texttt, \tt).
4843
4839
  var parts = [];
4844
4840
  for (var i = 0; i < text.length; i++) {
@@ -5057,10 +5053,9 @@ var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) {
5057
5053
  * See VListParam documentation above.
5058
5054
  */
5059
5055
  var makeVList = function makeVList(params, options) {
5060
- var {
5061
- children,
5062
- depth
5063
- } = getVListChildrenAndDepth(params);
5056
+ var _getVListChildrenAndD = getVListChildrenAndDepth(params),
5057
+ children = _getVListChildrenAndD.children,
5058
+ depth = _getVListChildrenAndD.depth;
5064
5059
  // Create a strut that is taller than any list item. The strut is added to
5065
5060
  // each item, where it will determine the item's baseline. Since it has
5066
5061
  // `overflow:hidden`, the strut's top edge will sit on the item's line box's
@@ -5252,7 +5247,10 @@ var svgData = {
5252
5247
  };
5253
5248
  var staticSvg = function staticSvg(value, options) {
5254
5249
  // Create a span with inline SVG for the element.
5255
- var [pathName, width, height] = svgData[value];
5250
+ var _svgData$value = svgData[value],
5251
+ pathName = _svgData$value[0],
5252
+ width = _svgData$value[1],
5253
+ height = _svgData$value[2];
5256
5254
  var path = new PathNode(pathName);
5257
5255
  var svgNode = new SvgNode([path], {
5258
5256
  "width": makeEm(width),
@@ -5262,7 +5260,7 @@ var staticSvg = function staticSvg(value, options) {
5262
5260
  "viewBox": "0 0 " + 1000 * width + " " + 1000 * height,
5263
5261
  "preserveAspectRatio": "xMinYMin"
5264
5262
  });
5265
- var span = makeSvgSpan(["overlay"], [svgNode], options);
5263
+ var span = makeSvgSpan(["katex-overlay"], [svgNode], options);
5266
5264
  span.height = height;
5267
5265
  span.style.height = makeEm(height);
5268
5266
  span.style.width = makeEm(width);
@@ -5381,12 +5379,10 @@ var _htmlGroupBuilders = {};
5381
5379
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5382
5380
  var _mathmlGroupBuilders = {};
5383
5381
  function defineFunction(data) {
5384
- var {
5385
- type,
5386
- names,
5387
- htmlBuilder,
5388
- mathmlBuilder
5389
- } = data;
5382
+ var type = data.type,
5383
+ names = data.names,
5384
+ htmlBuilder = data.htmlBuilder,
5385
+ mathmlBuilder = data.mathmlBuilder;
5390
5386
  for (var i = 0; i < names.length; ++i) {
5391
5387
  // To avoid destructuring and rebuilding an object,
5392
5388
  // we store the entire FunctionDefSpec object,
@@ -5408,11 +5404,9 @@ function defineFunction(data) {
5408
5404
  * stand-alone handler provided to `defineFunction`).
5409
5405
  */
5410
5406
  function defineFunctionBuilders(_ref) {
5411
- var {
5412
- type,
5413
- htmlBuilder,
5414
- mathmlBuilder
5415
- } = _ref;
5407
+ var type = _ref.type,
5408
+ htmlBuilder = _ref.htmlBuilder,
5409
+ mathmlBuilder = _ref.mathmlBuilder;
5416
5410
  if (htmlBuilder) {
5417
5411
  _htmlGroupBuilders[type] = htmlBuilder;
5418
5412
  }
@@ -5570,7 +5564,7 @@ var _traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, pre
5570
5564
  }
5571
5565
  if (nonspace) {
5572
5566
  prev.node = node;
5573
- } else if (isRoot && node.hasClass("newline")) {
5567
+ } else if (isRoot && node.hasClass("katex-newline")) {
5574
5568
  prev.node = makeSpan(["leftmost"]); // treat like beginning of line
5575
5569
  }
5576
5570
  prev.insertAfter = (index => n => {
@@ -5650,17 +5644,17 @@ var buildGroup$1 = function buildGroup(group, options, baseOptions) {
5650
5644
  };
5651
5645
  /**
5652
5646
  * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)
5653
- * into an unbreakable HTML node of class .base, with proper struts to
5647
+ * into an unbreakable HTML node of class .katex-base, with proper struts to
5654
5648
  * guarantee correct vertical extent. `buildHTML` calls this repeatedly to
5655
5649
  * make up the entire expression as a sequence of unbreakable units.
5656
5650
  */
5657
5651
  function buildHTMLUnbreakable(children, options) {
5658
5652
  // Compute height and depth of this chunk.
5659
- var body = makeSpan(["base"], children, options);
5653
+ var body = makeSpan(["katex-base"], children, options);
5660
5654
  // Add strut, which ensures that the top of the HTML element falls at
5661
5655
  // the height of the expression, and the bottom of the HTML element
5662
5656
  // falls at the depth of the expression.
5663
- var strut = makeSpan(["strut"]);
5657
+ var strut = makeSpan(["katex-strut"]);
5664
5658
  strut.style.height = makeEm(body.height + body.depth);
5665
5659
  if (body.depth) {
5666
5660
  strut.style.verticalAlign = makeEm(-body.depth);
@@ -5682,7 +5676,7 @@ function buildHTML(tree, options) {
5682
5676
  // Build the expression contained in the tree
5683
5677
  var expression = buildExpression$1(tree, options, "root");
5684
5678
  var eqnNum;
5685
- if (expression.length === 2 && expression[1].hasClass("tag")) {
5679
+ if (expression.length === 2 && expression[1].hasClass("katex-tag")) {
5686
5680
  // An environment with automatic equation numbers, e.g. {gather}.
5687
5681
  eqnNum = expression.pop();
5688
5682
  }
@@ -5700,7 +5694,7 @@ function buildHTML(tree, options) {
5700
5694
  // Put any post-operator glue on same line as operator.
5701
5695
  // Watch for \nobreak along the way, and stop at \newline.
5702
5696
  var nobreak = false;
5703
- while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
5697
+ while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("katex-newline")) {
5704
5698
  i++;
5705
5699
  parts.push(expression[i]);
5706
5700
  if (expression[i].hasClass("nobreak")) {
@@ -5712,7 +5706,7 @@ function buildHTML(tree, options) {
5712
5706
  children.push(buildHTMLUnbreakable(parts, options));
5713
5707
  parts = [];
5714
5708
  }
5715
- } else if (expression[i].hasClass("newline")) {
5709
+ } else if (expression[i].hasClass("katex-newline")) {
5716
5710
  // Write the line except the newline
5717
5711
  parts.pop();
5718
5712
  if (parts.length > 0) {
@@ -5730,7 +5724,7 @@ function buildHTML(tree, options) {
5730
5724
  var tagChild;
5731
5725
  if (tag) {
5732
5726
  tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options, true), options);
5733
- tagChild.classes = ["tag"];
5727
+ tagChild.classes = ["katex-tag"];
5734
5728
  children.push(tagChild);
5735
5729
  } else if (eqnNum) {
5736
5730
  children.push(eqnNum);
@@ -5795,10 +5789,10 @@ class MathNode {
5795
5789
  */
5796
5790
  toNode() {
5797
5791
  var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
5798
- for (var attr in this.attributes) {
5799
- if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
5800
- node.setAttribute(attr, this.attributes[attr]);
5801
- }
5792
+ for (var _ref2 of Object.entries(this.attributes)) {
5793
+ var attr = _ref2[0];
5794
+ var value = _ref2[1];
5795
+ node.setAttribute(attr, value);
5802
5796
  }
5803
5797
  if (this.classes.length > 0) {
5804
5798
  node.className = createClass(this.classes);
@@ -5824,12 +5818,12 @@ class MathNode {
5824
5818
  toMarkup() {
5825
5819
  var markup = "<" + this.type;
5826
5820
  // Add the attributes
5827
- for (var attr in this.attributes) {
5828
- if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
5829
- markup += " " + attr + "=\"";
5830
- markup += escape(this.attributes[attr]);
5831
- markup += "\"";
5832
- }
5821
+ for (var _ref4 of Object.entries(this.attributes)) {
5822
+ var attr = _ref4[0];
5823
+ var value = _ref4[1];
5824
+ markup += " " + attr + "=\"";
5825
+ markup += escape(value);
5826
+ markup += "\"";
5833
5827
  }
5834
5828
  if (this.classes.length > 0) {
5835
5829
  markup += " class =\"" + escape(createClass(this.classes)) + "\"";
@@ -5959,7 +5953,8 @@ var rowLikeTypes = new Set(["mrow", "mtable"]);
5959
5953
  * optional replacement from symbols.js.
5960
5954
  */
5961
5955
  var makeText = function makeText(text, mode, options) {
5962
- if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === "tt" || options.font && options.font.slice(4, 6) === "tt"))) {
5956
+ var _options$fontFamily, _options$font;
5957
+ if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(Object.prototype.hasOwnProperty.call(ligatures, text) && ((options == null || (_options$fontFamily = options.fontFamily) == null ? void 0 : _options$fontFamily.slice(4, 6)) === "tt" || (options == null || (_options$font = options.font) == null ? void 0 : _options$font.slice(4, 6)) === "tt"))) {
5963
5958
  text = symbols[mode][text].replace;
5964
5959
  }
5965
5960
  return new TextNode(text);
@@ -6422,7 +6417,7 @@ class Options {
6422
6417
  */
6423
6418
  sizingClasses(oldOptions) {
6424
6419
  if (oldOptions.size !== this.size) {
6425
- return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
6420
+ return ["katex-sizing", "reset-size" + oldOptions.size, "size" + this.size];
6426
6421
  } else {
6427
6422
  return [];
6428
6423
  }
@@ -6433,7 +6428,7 @@ class Options {
6433
6428
  */
6434
6429
  baseSizingClasses() {
6435
6430
  if (this.size !== Options.BASESIZE) {
6436
- return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
6431
+ return ["katex-sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
6437
6432
  } else {
6438
6433
  return [];
6439
6434
  }
@@ -6670,7 +6665,9 @@ var stretchySvg = function stretchySvg(group, options) {
6670
6665
  if (!data) {
6671
6666
  throw new Error("No SVG data for \"" + label + "\".");
6672
6667
  }
6673
- var [paths, _minWidth, _viewBoxHeight] = data;
6668
+ var paths = data[0],
6669
+ _minWidth = data[1],
6670
+ _viewBoxHeight = data[2];
6674
6671
  var _height2 = _viewBoxHeight / 1000;
6675
6672
  var numSvgChildren = paths.length;
6676
6673
  var widthClasses;
@@ -6711,17 +6708,16 @@ var stretchySvg = function stretchySvg(group, options) {
6711
6708
  }
6712
6709
  }
6713
6710
  return {
6714
- span: makeSpan(["stretchy"], spans, options),
6711
+ span: makeSpan(["katex-stretchy"], spans, options),
6715
6712
  minWidth: _minWidth,
6716
6713
  height: _height2
6717
6714
  };
6718
6715
  }
6719
6716
  } // buildSvgSpan_()
6720
- var {
6721
- span,
6722
- minWidth,
6723
- height
6724
- } = buildSvgSpan_();
6717
+ var _buildSvgSpan_ = buildSvgSpan_(),
6718
+ span = _buildSvgSpan_.span,
6719
+ minWidth = _buildSvgSpan_.minWidth,
6720
+ height = _buildSvgSpan_.height;
6725
6721
  // Note that we are returning span.depth = 0.
6726
6722
  // Any adjustments relative to the baseline must be done in buildHTML.
6727
6723
  span.height = height;
@@ -6736,7 +6732,7 @@ var stretchyEnclose = function stretchyEnclose(inner, label, topPad, bottomPad,
6736
6732
  var img;
6737
6733
  var totalHeight = inner.height + inner.depth + topPad + bottomPad;
6738
6734
  if (/fbox|color|angl/.test(label)) {
6739
- img = makeSpan(["stretchy", label], [], options);
6735
+ img = makeSpan(["katex-stretchy", label], [], options);
6740
6736
  if (label === "fbox") {
6741
6737
  var color = options.color && options.getColor();
6742
6738
  if (color) {
@@ -6782,27 +6778,12 @@ var stretchyEnclose = function stretchyEnclose(inner, label, topPad, bottomPad,
6782
6778
  * `symbols.ts` so that consumers (notably `contrib/render-a11y-string`) can
6783
6779
  * pull in `isAtom` without dragging in the ~870-line symbol tables.
6784
6780
  */
6785
- // Some of these have a "-token" suffix since these are also used as `ParseNode`
6786
- // types for raw text tokens, and we want to avoid conflicts with higher-level
6787
- // `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
6788
- // looking up the `symbols` map.
6789
- var ATOMS = {
6790
- "bin": 1,
6791
- "close": 1,
6792
- "inner": 1,
6793
- "open": 1,
6794
- "punct": 1,
6795
- "rel": 1
6796
- };
6797
- var NON_ATOMS = {
6798
- "accent-token": 1,
6799
- "mathord": 1,
6800
- "op-token": 1,
6801
- "spacing": 1,
6802
- "textord": 1
6803
- };
6781
+ var atomList = ["bin", "close", "inner", "open", "punct", "rel"];
6782
+ var nonAtomList = ["accent-token", "mathord", "op-token", "spacing", "textord"];
6783
+ var Atoms = new Set(atomList);
6784
+ var NonAtoms = new Set(nonAtomList);
6804
6785
  function isAtom(value) {
6805
- return value in ATOMS;
6786
+ return Atoms.has(value);
6806
6787
  }
6807
6788
 
6808
6789
  /**
@@ -6831,7 +6812,7 @@ function assertSymbolNodeType(node) {
6831
6812
  * returns null.
6832
6813
  */
6833
6814
  function checkSymbolNodeType(node) {
6834
- if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
6815
+ if (node.type === "atom" || NonAtoms.has(node.type)) {
6835
6816
  return node;
6836
6817
  }
6837
6818
  return null;
@@ -6933,7 +6914,7 @@ var htmlBuilder$a = (grp, options) => {
6933
6914
  }
6934
6915
  // Shift the accent over by the skew.
6935
6916
  var left = skew;
6936
- // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`
6917
+ // CSS defines `.katex .katex-accent .accent-body:not(.accent-full) { width: 0 }`
6937
6918
  // so that the accent doesn't contribute to the bounding box.
6938
6919
  // We need to shift the character by its width (effectively half
6939
6920
  // its width) to compensate.
@@ -6977,7 +6958,7 @@ var htmlBuilder$a = (grp, options) => {
6977
6958
  }]
6978
6959
  });
6979
6960
  }
6980
- var accentWrap = makeSpan(["mord", "accent"], [accentBody], options);
6961
+ var accentWrap = makeSpan(["mord", "katex-accent"], [accentBody], options);
6981
6962
  if (supSubGroup) {
6982
6963
  // Here, we replace the "base" child of the supsub with our newly
6983
6964
  // generated accent.
@@ -7053,10 +7034,8 @@ defineFunction({
7053
7034
  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
7054
7035
  numArgs: 1,
7055
7036
  handler: (_ref, args) => {
7056
- var {
7057
- parser,
7058
- funcName
7059
- } = _ref;
7037
+ var parser = _ref.parser,
7038
+ funcName = _ref.funcName;
7060
7039
  var base = args[0];
7061
7040
  return {
7062
7041
  type: "accentUnder",
@@ -7115,10 +7094,8 @@ defineFunction({
7115
7094
  numArgs: 1,
7116
7095
  numOptionalArgs: 1,
7117
7096
  handler(_ref, args, optArgs) {
7118
- var {
7119
- parser,
7120
- funcName
7121
- } = _ref;
7097
+ var parser = _ref.parser,
7098
+ funcName = _ref.funcName;
7122
7099
  return {
7123
7100
  type: "xArrow",
7124
7101
  mode: parser.mode,
@@ -7263,10 +7240,8 @@ defineFunction({
7263
7240
  numArgs: 1,
7264
7241
  primitive: true,
7265
7242
  handler(_ref, args) {
7266
- var {
7267
- parser,
7268
- funcName
7269
- } = _ref;
7243
+ var parser = _ref.parser,
7244
+ funcName = _ref.funcName;
7270
7245
  var body = args[0];
7271
7246
  return {
7272
7247
  type: "mclass",
@@ -7298,9 +7273,7 @@ defineFunction({
7298
7273
  names: ["\\@binrel"],
7299
7274
  numArgs: 2,
7300
7275
  handler(_ref2, args) {
7301
- var {
7302
- parser
7303
- } = _ref2;
7276
+ var parser = _ref2.parser;
7304
7277
  return {
7305
7278
  type: "mclass",
7306
7279
  mode: parser.mode,
@@ -7316,10 +7289,8 @@ defineFunction({
7316
7289
  names: ["\\stackrel", "\\overset", "\\underset"],
7317
7290
  numArgs: 2,
7318
7291
  handler(_ref3, args) {
7319
- var {
7320
- parser,
7321
- funcName
7322
- } = _ref3;
7292
+ var parser = _ref3.parser,
7293
+ funcName = _ref3.funcName;
7323
7294
  var baseArg = args[1];
7324
7295
  var shiftedArg = args[0];
7325
7296
  var mclass;
@@ -7370,9 +7341,7 @@ defineFunction({
7370
7341
  numArgs: 1,
7371
7342
  allowedInText: true,
7372
7343
  handler(_ref, args) {
7373
- var {
7374
- parser
7375
- } = _ref;
7344
+ var parser = _ref.parser;
7376
7345
  return {
7377
7346
  type: "pmb",
7378
7347
  mode: parser.mode,
@@ -7616,10 +7585,8 @@ defineFunction({
7616
7585
  names: ["\\\\cdleft", "\\\\cdright"],
7617
7586
  numArgs: 1,
7618
7587
  handler(_ref, args) {
7619
- var {
7620
- parser,
7621
- funcName
7622
- } = _ref;
7588
+ var parser = _ref.parser,
7589
+ funcName = _ref.funcName;
7623
7590
  return {
7624
7591
  type: "cdlabel",
7625
7592
  mode: parser.mode,
@@ -7659,9 +7626,7 @@ defineFunction({
7659
7626
  names: ["\\\\cdparent"],
7660
7627
  numArgs: 1,
7661
7628
  handler(_ref2, args) {
7662
- var {
7663
- parser
7664
- } = _ref2;
7629
+ var parser = _ref2.parser;
7665
7630
  return {
7666
7631
  type: "cdlabelparent",
7667
7632
  mode: parser.mode,
@@ -7690,9 +7655,7 @@ defineFunction({
7690
7655
  numArgs: 1,
7691
7656
  allowedInText: true,
7692
7657
  handler(_ref, args) {
7693
- var {
7694
- parser
7695
- } = _ref;
7658
+ var parser = _ref.parser;
7696
7659
  var arg = assertNodeType(args[0], "ordgroup");
7697
7660
  var group = arg.body;
7698
7661
  var number = "";
@@ -7744,9 +7707,7 @@ defineFunction({
7744
7707
  allowedInText: true,
7745
7708
  argTypes: ["color", "original"],
7746
7709
  handler(_ref, args) {
7747
- var {
7748
- parser
7749
- } = _ref;
7710
+ var parser = _ref.parser;
7750
7711
  var color = assertNodeType(args[0], "color-token").color;
7751
7712
  var body = args[1];
7752
7713
  return {
@@ -7766,10 +7727,8 @@ defineFunction({
7766
7727
  allowedInText: true,
7767
7728
  argTypes: ["color"],
7768
7729
  handler(_ref2, args) {
7769
- var {
7770
- parser,
7771
- breakOnTokenText
7772
- } = _ref2;
7730
+ var parser = _ref2.parser,
7731
+ breakOnTokenText = _ref2.breakOnTokenText;
7773
7732
  var color = assertNodeType(args[0], "color-token").color;
7774
7733
  // Set macro \current@color in current namespace to store the current
7775
7734
  // color, mimicking the behavior of color.sty.
@@ -7796,9 +7755,7 @@ defineFunction({
7796
7755
  numOptionalArgs: 0,
7797
7756
  allowedInText: true,
7798
7757
  handler(_ref, args, optArgs) {
7799
- var {
7800
- parser
7801
- } = _ref;
7758
+ var parser = _ref.parser;
7802
7759
  var size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
7803
7760
  var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode");
7804
7761
  return {
@@ -7813,7 +7770,7 @@ defineFunction({
7813
7770
  htmlBuilder(group, options) {
7814
7771
  var span = makeSpan(["mspace"], [], options);
7815
7772
  if (group.newLine) {
7816
- span.classes.push("newline");
7773
+ span.classes.push("katex-newline");
7817
7774
  if (group.size) {
7818
7775
  span.style.marginTop = makeEm(calculateSize(group.size, options));
7819
7776
  }
@@ -7888,10 +7845,8 @@ defineFunction({
7888
7845
  numArgs: 0,
7889
7846
  allowedInText: true,
7890
7847
  handler(_ref) {
7891
- var {
7892
- parser,
7893
- funcName
7894
- } = _ref;
7848
+ var parser = _ref.parser,
7849
+ funcName = _ref.funcName;
7895
7850
  parser.consumeSpaces();
7896
7851
  var token = parser.fetch();
7897
7852
  if (globalMap[token.text]) {
@@ -7915,10 +7870,8 @@ defineFunction({
7915
7870
  allowedInText: true,
7916
7871
  primitive: true,
7917
7872
  handler(_ref2) {
7918
- var {
7919
- parser,
7920
- funcName
7921
- } = _ref2;
7873
+ var parser = _ref2.parser,
7874
+ funcName = _ref2.funcName;
7922
7875
  var tok = parser.gullet.popToken();
7923
7876
  var name = tok.text;
7924
7877
  if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
@@ -7958,9 +7911,8 @@ defineFunction({
7958
7911
  }
7959
7912
  }
7960
7913
  // replacement text, enclosed in '{' and '}' and properly nested
7961
- var {
7962
- tokens
7963
- } = parser.gullet.consumeArg();
7914
+ var _parser$gullet$consum = parser.gullet.consumeArg(),
7915
+ tokens = _parser$gullet$consum.tokens;
7964
7916
  if (insert) {
7965
7917
  tokens.unshift(insert);
7966
7918
  }
@@ -7992,10 +7944,8 @@ defineFunction({
7992
7944
  allowedInText: true,
7993
7945
  primitive: true,
7994
7946
  handler(_ref3) {
7995
- var {
7996
- parser,
7997
- funcName
7998
- } = _ref3;
7947
+ var parser = _ref3.parser,
7948
+ funcName = _ref3.funcName;
7999
7949
  var name = checkControlSequence(parser.gullet.popToken());
8000
7950
  parser.gullet.consumeSpaces();
8001
7951
  var tok = getRHS(parser);
@@ -8015,10 +7965,8 @@ defineFunction({
8015
7965
  allowedInText: true,
8016
7966
  primitive: true,
8017
7967
  handler(_ref4) {
8018
- var {
8019
- parser,
8020
- funcName
8021
- } = _ref4;
7968
+ var parser = _ref4.parser,
7969
+ funcName = _ref4.funcName;
8022
7970
  var name = checkControlSequence(parser.gullet.popToken());
8023
7971
  var middle = parser.gullet.popToken();
8024
7972
  var tok = parser.gullet.popToken();
@@ -8986,7 +8934,7 @@ var htmlBuilder$7 = (group, options) => {
8986
8934
  // subjects that should get the "tall" treatment.
8987
8935
  var isSingleChar = isCharacterBox(group.body);
8988
8936
  if (label === "sout") {
8989
- img = makeSpan(["stretchy", "sout"]);
8937
+ img = makeSpan(["katex-stretchy", "katex-sout"]);
8990
8938
  img.height = options.fontMetrics().defaultRuleThickness / scale;
8991
8939
  imgShift = -0.5 * options.fontMetrics().xHeight;
8992
8940
  } else if (label === "phase") {
@@ -9165,10 +9113,8 @@ defineFunction({
9165
9113
  allowedInText: true,
9166
9114
  argTypes: ["color", "hbox"],
9167
9115
  handler(_ref, args, optArgs) {
9168
- var {
9169
- parser,
9170
- funcName
9171
- } = _ref;
9116
+ var parser = _ref.parser,
9117
+ funcName = _ref.funcName;
9172
9118
  var color = assertNodeType(args[0], "color-token").color;
9173
9119
  var body = args[1];
9174
9120
  return {
@@ -9189,10 +9135,8 @@ defineFunction({
9189
9135
  allowedInText: true,
9190
9136
  argTypes: ["color", "color", "hbox"],
9191
9137
  handler(_ref2, args, optArgs) {
9192
- var {
9193
- parser,
9194
- funcName
9195
- } = _ref2;
9138
+ var parser = _ref2.parser,
9139
+ funcName = _ref2.funcName;
9196
9140
  var borderColor = assertNodeType(args[0], "color-token").color;
9197
9141
  var backgroundColor = assertNodeType(args[1], "color-token").color;
9198
9142
  var body = args[2];
@@ -9213,9 +9157,7 @@ defineFunction({
9213
9157
  argTypes: ["hbox"],
9214
9158
  allowedInText: true,
9215
9159
  handler(_ref3, args) {
9216
- var {
9217
- parser
9218
- } = _ref3;
9160
+ var parser = _ref3.parser;
9219
9161
  return {
9220
9162
  type: "enclose",
9221
9163
  mode: parser.mode,
@@ -9229,10 +9171,8 @@ defineFunction({
9229
9171
  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\phase"],
9230
9172
  numArgs: 1,
9231
9173
  handler(_ref4, args) {
9232
- var {
9233
- parser,
9234
- funcName
9235
- } = _ref4;
9174
+ var parser = _ref4.parser,
9175
+ funcName = _ref4.funcName;
9236
9176
  var body = args[0];
9237
9177
  return {
9238
9178
  type: "enclose",
@@ -9248,10 +9188,8 @@ defineFunction({
9248
9188
  numArgs: 1,
9249
9189
  allowedInText: true,
9250
9190
  handler(_ref5, args) {
9251
- var {
9252
- parser,
9253
- funcName
9254
- } = _ref5;
9191
+ var parser = _ref5.parser,
9192
+ funcName = _ref5.funcName;
9255
9193
  if (parser.mode === "math") {
9256
9194
  parser.settings.reportNonstrict("mathVsSout", "LaTeX's \\sout works only in text mode");
9257
9195
  }
@@ -9271,9 +9209,7 @@ defineFunction({
9271
9209
  argTypes: ["hbox"],
9272
9210
  allowedInText: false,
9273
9211
  handler(_ref6, args) {
9274
- var {
9275
- parser
9276
- } = _ref6;
9212
+ var parser = _ref6.parser;
9277
9213
  return {
9278
9214
  type: "enclose",
9279
9215
  mode: parser.mode,
@@ -9290,14 +9226,12 @@ defineFunction({
9290
9226
  */
9291
9227
  var _environments = {};
9292
9228
  function defineEnvironment(_ref) {
9293
- var {
9294
- type,
9295
- names,
9296
- props,
9297
- handler,
9298
- htmlBuilder,
9299
- mathmlBuilder
9300
- } = _ref;
9229
+ var type = _ref.type,
9230
+ names = _ref.names,
9231
+ props = _ref.props,
9232
+ handler = _ref.handler,
9233
+ htmlBuilder = _ref.htmlBuilder,
9234
+ mathmlBuilder = _ref.mathmlBuilder;
9301
9235
  // Set default values of environments.
9302
9236
  var data = {
9303
9237
  type,
@@ -9450,18 +9384,16 @@ function getAutoTag(name) {
9450
9384
  * ("text", "display", etc.), then each cell is cast into that style.
9451
9385
  */
9452
9386
  function parseArray(parser, _ref, style) {
9453
- var {
9454
- hskipBeforeAndAfter,
9455
- addJot,
9456
- cols,
9457
- arraystretch,
9458
- colSeparationType,
9459
- autoTag,
9460
- singleRow,
9461
- emptySingleRow,
9462
- maxNumCols,
9463
- leqno
9464
- } = _ref;
9387
+ var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,
9388
+ addJot = _ref.addJot,
9389
+ cols = _ref.cols,
9390
+ arraystretch = _ref.arraystretch,
9391
+ colSeparationType = _ref.colSeparationType,
9392
+ autoTag = _ref.autoTag,
9393
+ singleRow = _ref.singleRow,
9394
+ emptySingleRow = _ref.emptySingleRow,
9395
+ maxNumCols = _ref.maxNumCols,
9396
+ leqno = _ref.leqno;
9465
9397
  parser.gullet.beginGroup();
9466
9398
  if (!singleRow) {
9467
9399
  // \cr is equivalent to \\ without the optional size argument (see below)
@@ -9820,8 +9752,8 @@ var htmlBuilder$6 = function htmlBuilder(group, options) {
9820
9752
  var tableBody = makeSpan(["mtable"], cols);
9821
9753
  // Add \hline(s), if any.
9822
9754
  if (hlines.length > 0) {
9823
- var line = makeLineSpan("hline", options, ruleThickness);
9824
- var dashes = makeLineSpan("hdashline", options, ruleThickness);
9755
+ var line = makeLineSpan("katex-hline", options, ruleThickness);
9756
+ var dashes = makeLineSpan("katex-hdashline", options, ruleThickness);
9825
9757
  var vListElems = [{
9826
9758
  type: "elem",
9827
9759
  elem: tableBody,
@@ -9856,7 +9788,7 @@ var htmlBuilder$6 = function htmlBuilder(group, options) {
9856
9788
  positionType: "individualShift",
9857
9789
  children: tagSpans
9858
9790
  });
9859
- var tagCol = makeSpan(["tag"], [eqnNumCol], options);
9791
+ var tagCol = makeSpan(["katex-tag"], [eqnNumCol], options);
9860
9792
  return makeFragment([tableBody, tagCol]);
9861
9793
  }
9862
9794
  };
@@ -10398,10 +10330,8 @@ defineFunction({
10398
10330
  numArgs: 1,
10399
10331
  argTypes: ["text"],
10400
10332
  handler(_ref, args) {
10401
- var {
10402
- parser,
10403
- funcName
10404
- } = _ref;
10333
+ var parser = _ref.parser,
10334
+ funcName = _ref.funcName;
10405
10335
  var nameGroup = args[0];
10406
10336
  if (nameGroup.type !== "ordgroup") {
10407
10337
  throw new ParseError("Invalid environment name", nameGroup);
@@ -10412,16 +10342,15 @@ defineFunction({
10412
10342
  }
10413
10343
  if (funcName === "\\begin") {
10414
10344
  // begin...end is similar to left...right
10415
- if (!environments.hasOwnProperty(envName)) {
10345
+ if (!Object.prototype.hasOwnProperty.call(environments, envName)) {
10416
10346
  throw new ParseError("No such environment: " + envName, nameGroup);
10417
10347
  }
10418
10348
  // Build the environment object. Arguments and other information will
10419
10349
  // be made available to the begin and end methods using properties.
10420
10350
  var env = environments[envName];
10421
- var {
10422
- args: _args,
10423
- optArgs
10424
- } = parser.parseArguments("\\begin{" + envName + "}", env);
10351
+ var _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env),
10352
+ _args = _parser$parseArgument.args,
10353
+ optArgs = _parser$parseArgument.optArgs;
10425
10354
  var context = {
10426
10355
  mode: parser.mode,
10427
10356
  envName,
@@ -10477,10 +10406,8 @@ defineFunction({
10477
10406
  numArgs: 1,
10478
10407
  allowedInArgument: true,
10479
10408
  handler: (_ref, args) => {
10480
- var {
10481
- parser,
10482
- funcName
10483
- } = _ref;
10409
+ var parser = _ref.parser,
10410
+ funcName = _ref.funcName;
10484
10411
  var body = normalizeArgument(args[0]);
10485
10412
  var func = funcName in fontAliases ? fontAliases[funcName] : funcName;
10486
10413
  return {
@@ -10498,9 +10425,7 @@ defineFunction({
10498
10425
  names: ["\\boldsymbol", "\\bm"],
10499
10426
  numArgs: 1,
10500
10427
  handler: (_ref2, args) => {
10501
- var {
10502
- parser
10503
- } = _ref2;
10428
+ var parser = _ref2.parser;
10504
10429
  var body = args[0];
10505
10430
  // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
10506
10431
  // argument's bin|rel|ord status
@@ -10525,14 +10450,10 @@ defineFunction({
10525
10450
  numArgs: 0,
10526
10451
  allowedInText: true,
10527
10452
  handler: (_ref3, args) => {
10528
- var {
10529
- parser,
10530
- funcName,
10531
- breakOnTokenText
10532
- } = _ref3;
10533
- var {
10534
- mode
10535
- } = parser;
10453
+ var parser = _ref3.parser,
10454
+ funcName = _ref3.funcName,
10455
+ breakOnTokenText = _ref3.breakOnTokenText;
10456
+ var mode = parser.mode;
10536
10457
  var body = parser.parseExpression(true, breakOnTokenText);
10537
10458
  return {
10538
10459
  type: "font",
@@ -10728,10 +10649,8 @@ defineFunction({
10728
10649
  numArgs: 2,
10729
10650
  allowedInArgument: true,
10730
10651
  handler: (_ref, args) => {
10731
- var {
10732
- parser,
10733
- funcName
10734
- } = _ref;
10652
+ var parser = _ref.parser,
10653
+ funcName = _ref.funcName;
10735
10654
  var numer = args[0];
10736
10655
  var denom = args[1];
10737
10656
  var hasBarLine;
@@ -10797,11 +10716,9 @@ defineFunction({
10797
10716
  numArgs: 0,
10798
10717
  infix: true,
10799
10718
  handler(_ref2) {
10800
- var {
10801
- parser,
10802
- funcName,
10803
- token
10804
- } = _ref2;
10719
+ var parser = _ref2.parser,
10720
+ funcName = _ref2.funcName,
10721
+ token = _ref2.token;
10805
10722
  var replaceWith;
10806
10723
  switch (funcName) {
10807
10724
  case "\\over":
@@ -10846,9 +10763,7 @@ defineFunction({
10846
10763
  allowedInArgument: true,
10847
10764
  argTypes: ["math", "math", "size", "text", "math", "math"],
10848
10765
  handler(_ref3, args) {
10849
- var {
10850
- parser
10851
- } = _ref3;
10766
+ var parser = _ref3.parser;
10852
10767
  var numer = args[4];
10853
10768
  var denom = args[5];
10854
10769
  // Look into the parse nodes to get the desired delimiters.
@@ -10901,11 +10816,9 @@ defineFunction({
10901
10816
  argTypes: ["size"],
10902
10817
  infix: true,
10903
10818
  handler(_ref4, args) {
10904
- var {
10905
- parser,
10906
- funcName,
10907
- token
10908
- } = _ref4;
10819
+ var parser = _ref4.parser;
10820
+ _ref4.funcName;
10821
+ var token = _ref4.token;
10909
10822
  return {
10910
10823
  type: "infix",
10911
10824
  mode: parser.mode,
@@ -10921,10 +10834,8 @@ defineFunction({
10921
10834
  numArgs: 3,
10922
10835
  argTypes: ["math", "size", "math"],
10923
10836
  handler: (_ref5, args) => {
10924
- var {
10925
- parser,
10926
- funcName
10927
- } = _ref5;
10837
+ var parser = _ref5.parser;
10838
+ _ref5.funcName;
10928
10839
  var numer = args[0];
10929
10840
  var barSize = assertNodeType(args[1], "infix").size;
10930
10841
  if (!barSize) {
@@ -11053,10 +10964,8 @@ defineFunction({
11053
10964
  names: ["\\overbrace", "\\underbrace", "\\overbracket", "\\underbracket"],
11054
10965
  numArgs: 1,
11055
10966
  handler(_ref, args) {
11056
- var {
11057
- parser,
11058
- funcName
11059
- } = _ref;
10967
+ var parser = _ref.parser,
10968
+ funcName = _ref.funcName;
11060
10969
  return {
11061
10970
  type: "horizBrace",
11062
10971
  mode: parser.mode,
@@ -11076,9 +10985,7 @@ defineFunction({
11076
10985
  argTypes: ["url", "original"],
11077
10986
  allowedInText: true,
11078
10987
  handler: (_ref, args) => {
11079
- var {
11080
- parser
11081
- } = _ref;
10988
+ var parser = _ref.parser;
11082
10989
  var body = args[1];
11083
10990
  var href = assertNodeType(args[0], "url").url;
11084
10991
  if (!parser.settings.isTrusted({
@@ -11114,9 +11021,7 @@ defineFunction({
11114
11021
  argTypes: ["url"],
11115
11022
  allowedInText: true,
11116
11023
  handler: (_ref2, args) => {
11117
- var {
11118
- parser
11119
- } = _ref2;
11024
+ var parser = _ref2.parser;
11120
11025
  var href = assertNodeType(args[0], "url").url;
11121
11026
  if (!parser.settings.isTrusted({
11122
11027
  command: "\\url",
@@ -11163,9 +11068,7 @@ defineFunction({
11163
11068
  allowedInText: true,
11164
11069
  primitive: true,
11165
11070
  handler(_ref, args) {
11166
- var {
11167
- parser
11168
- } = _ref;
11071
+ var parser = _ref.parser;
11169
11072
  return {
11170
11073
  type: "hbox",
11171
11074
  mode: parser.mode,
@@ -11188,11 +11091,9 @@ defineFunction({
11188
11091
  argTypes: ["raw", "original"],
11189
11092
  allowedInText: true,
11190
11093
  handler: (_ref, args) => {
11191
- var {
11192
- parser,
11193
- funcName,
11194
- token
11195
- } = _ref;
11094
+ var parser = _ref.parser,
11095
+ funcName = _ref.funcName;
11096
+ _ref.token;
11196
11097
  var value = assertNodeType(args[0], "raw").string;
11197
11098
  var body = args[1];
11198
11099
  if (parser.settings.strict) {
@@ -11261,9 +11162,11 @@ defineFunction({
11261
11162
  classes.push(...group.attributes.class.trim().split(/\s+/));
11262
11163
  }
11263
11164
  var span = makeSpan(classes, elements, options);
11264
- for (var attr in group.attributes) {
11265
- if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
11266
- span.setAttribute(attr, group.attributes[attr]);
11165
+ for (var _ref3 of Object.entries(group.attributes)) {
11166
+ var attr = _ref3[0];
11167
+ var value = _ref3[1];
11168
+ if (attr !== "class") {
11169
+ span.setAttribute(attr, value);
11267
11170
  }
11268
11171
  }
11269
11172
  return span;
@@ -11280,9 +11183,7 @@ defineFunction({
11280
11183
  allowedInArgument: true,
11281
11184
  allowedInText: true,
11282
11185
  handler: (_ref, args) => {
11283
- var {
11284
- parser
11285
- } = _ref;
11186
+ var parser = _ref.parser;
11286
11187
  return {
11287
11188
  type: "htmlmathml",
11288
11189
  mode: parser.mode,
@@ -11331,9 +11232,7 @@ defineFunction({
11331
11232
  argTypes: ["raw", "url"],
11332
11233
  allowedInText: false,
11333
11234
  handler: (_ref, args, optArgs) => {
11334
- var {
11335
- parser
11336
- } = _ref;
11235
+ var parser = _ref.parser;
11337
11236
  var width = {
11338
11237
  number: 0,
11339
11238
  unit: "em"
@@ -11450,10 +11349,8 @@ defineFunction({
11450
11349
  primitive: true,
11451
11350
  allowedInText: true,
11452
11351
  handler(_ref, args) {
11453
- var {
11454
- parser,
11455
- funcName
11456
- } = _ref;
11352
+ var parser = _ref.parser,
11353
+ funcName = _ref.funcName;
11457
11354
  var size = assertNodeType(args[0], "size");
11458
11355
  if (parser.settings.strict) {
11459
11356
  var mathFunction = funcName[1] === 'm'; // \mkern, \mskip
@@ -11494,10 +11391,8 @@ defineFunction({
11494
11391
  numArgs: 1,
11495
11392
  allowedInText: true,
11496
11393
  handler: (_ref, args) => {
11497
- var {
11498
- parser,
11499
- funcName
11500
- } = _ref;
11394
+ var parser = _ref.parser,
11395
+ funcName = _ref.funcName;
11501
11396
  var body = args[0];
11502
11397
  return {
11503
11398
  type: "lap",
@@ -11512,19 +11407,19 @@ defineFunction({
11512
11407
  if (group.alignment === "clap") {
11513
11408
  // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
11514
11409
  inner = makeSpan([], [buildGroup$1(group.body, options)]);
11515
- // wrap, since CSS will center a .clap > .inner > span
11516
- inner = makeSpan(["inner"], [inner], options);
11410
+ // wrap, since CSS will center a .clap > .katex-inner > span
11411
+ inner = makeSpan(["katex-inner"], [inner], options);
11517
11412
  } else {
11518
- inner = makeSpan(["inner"], [buildGroup$1(group.body, options)]);
11413
+ inner = makeSpan(["katex-inner"], [buildGroup$1(group.body, options)]);
11519
11414
  }
11520
- var fix = makeSpan(["fix"], []);
11415
+ var fix = makeSpan(["katex-fix"], []);
11521
11416
  var node = makeSpan([group.alignment], [inner, fix], options);
11522
11417
  // At this point, we have correctly set horizontal alignment of the
11523
11418
  // two items involved in the lap.
11524
11419
  // Next, use a strut to set the height of the HTML bounding box.
11525
11420
  // Otherwise, a tall argument may be misplaced.
11526
11421
  // This code resolved issue #1153
11527
- var strut = makeSpan(["strut"]);
11422
+ var strut = makeSpan(["katex-strut"]);
11528
11423
  strut.style.height = makeEm(node.height + node.depth);
11529
11424
  if (node.depth) {
11530
11425
  strut.style.verticalAlign = makeEm(-node.depth);
@@ -11532,8 +11427,8 @@ defineFunction({
11532
11427
  node.children.unshift(strut);
11533
11428
  // Next, prevent vertical misplacement when next to something tall.
11534
11429
  // This code resolves issue #1234
11535
- node = makeSpan(["thinbox"], [node], options);
11536
- return makeSpan(["mord", "vbox"], [node], options);
11430
+ node = makeSpan(["katex-thinbox"], [node], options);
11431
+ return makeSpan(["mord", "katex-vbox"], [node], options);
11537
11432
  },
11538
11433
  mathmlBuilder: (group, options) => {
11539
11434
  // mathllap, mathrlap, mathclap
@@ -11555,10 +11450,8 @@ defineFunction({
11555
11450
  allowedInText: true,
11556
11451
  allowedInMath: false,
11557
11452
  handler(_ref, args) {
11558
- var {
11559
- funcName,
11560
- parser
11561
- } = _ref;
11453
+ var funcName = _ref.funcName,
11454
+ parser = _ref.parser;
11562
11455
  var outerMode = parser.mode;
11563
11456
  parser.switchMode("math");
11564
11457
  var close = funcName === "\\(" ? "\\)" : "$";
@@ -11607,9 +11500,7 @@ defineFunction({
11607
11500
  numArgs: 4,
11608
11501
  primitive: true,
11609
11502
  handler: (_ref, args) => {
11610
- var {
11611
- parser
11612
- } = _ref;
11503
+ var parser = _ref.parser;
11613
11504
  return {
11614
11505
  type: "mathchoice",
11615
11506
  mode: parser.mode,
@@ -11902,10 +11793,8 @@ defineFunction({
11902
11793
  names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22c0", "\u22c1", "\u22c2", "\u22c3", "\u2a00", "\u2a01", "\u2a02", "\u2a04", "\u2a06"],
11903
11794
  numArgs: 0,
11904
11795
  handler: (_ref, args) => {
11905
- var {
11906
- parser,
11907
- funcName
11908
- } = _ref;
11796
+ var parser = _ref.parser,
11797
+ funcName = _ref.funcName;
11909
11798
  var fName = funcName;
11910
11799
  if (fName.length === 1) {
11911
11800
  fName = singleCharBigOps[fName];
@@ -11928,9 +11817,7 @@ defineFunction({
11928
11817
  numArgs: 1,
11929
11818
  primitive: true,
11930
11819
  handler: (_ref2, args) => {
11931
- var {
11932
- parser
11933
- } = _ref2;
11820
+ var parser = _ref2.parser;
11934
11821
  var body = args[0];
11935
11822
  return {
11936
11823
  type: "op",
@@ -11959,10 +11846,8 @@ defineFunction({
11959
11846
  names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
11960
11847
  numArgs: 0,
11961
11848
  handler(_ref3) {
11962
- var {
11963
- parser,
11964
- funcName
11965
- } = _ref3;
11849
+ var parser = _ref3.parser,
11850
+ funcName = _ref3.funcName;
11966
11851
  return {
11967
11852
  type: "op",
11968
11853
  mode: parser.mode,
@@ -11979,10 +11864,8 @@ defineFunction({
11979
11864
  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
11980
11865
  numArgs: 0,
11981
11866
  handler(_ref4) {
11982
- var {
11983
- parser,
11984
- funcName
11985
- } = _ref4;
11867
+ var parser = _ref4.parser,
11868
+ funcName = _ref4.funcName;
11986
11869
  return {
11987
11870
  type: "op",
11988
11871
  mode: parser.mode,
@@ -12000,10 +11883,8 @@ defineFunction({
12000
11883
  numArgs: 0,
12001
11884
  allowedInArgument: true,
12002
11885
  handler(_ref5) {
12003
- var {
12004
- parser,
12005
- funcName
12006
- } = _ref5;
11886
+ var parser = _ref5.parser,
11887
+ funcName = _ref5.funcName;
12007
11888
  var fName = funcName;
12008
11889
  if (fName.length === 1) {
12009
11890
  fName = singleCharIntegrals[fName];
@@ -12128,10 +12009,8 @@ defineFunction({
12128
12009
  names: ["\\operatorname@", "\\operatornamewithlimits"],
12129
12010
  numArgs: 1,
12130
12011
  handler: (_ref, args) => {
12131
- var {
12132
- parser,
12133
- funcName
12134
- } = _ref;
12012
+ var parser = _ref.parser,
12013
+ funcName = _ref.funcName;
12135
12014
  var body = args[0];
12136
12015
  return {
12137
12016
  type: "operatorname",
@@ -12165,9 +12044,7 @@ defineFunction({
12165
12044
  names: ["\\overline"],
12166
12045
  numArgs: 1,
12167
12046
  handler(_ref, args) {
12168
- var {
12169
- parser
12170
- } = _ref;
12047
+ var parser = _ref.parser;
12171
12048
  var body = args[0];
12172
12049
  return {
12173
12050
  type: "overline",
@@ -12199,7 +12076,7 @@ defineFunction({
12199
12076
  size: defaultRuleThickness
12200
12077
  }]
12201
12078
  });
12202
- return makeSpan(["mord", "overline"], [vlist], options);
12079
+ return makeSpan(["mord", "katex-overline"], [vlist], options);
12203
12080
  },
12204
12081
  mathmlBuilder(group, options) {
12205
12082
  var operator = new MathNode("mo", [new TextNode("\u203e")]);
@@ -12216,9 +12093,7 @@ defineFunction({
12216
12093
  numArgs: 1,
12217
12094
  allowedInText: true,
12218
12095
  handler: (_ref, args) => {
12219
- var {
12220
- parser
12221
- } = _ref;
12096
+ var parser = _ref.parser;
12222
12097
  var body = args[0];
12223
12098
  return {
12224
12099
  type: "phantom",
@@ -12244,9 +12119,7 @@ defineFunction({
12244
12119
  numArgs: 1,
12245
12120
  allowedInText: true,
12246
12121
  handler: (_ref2, args) => {
12247
- var {
12248
- parser
12249
- } = _ref2;
12122
+ var parser = _ref2.parser;
12250
12123
  var body = args[0];
12251
12124
  return {
12252
12125
  type: "vphantom",
@@ -12255,8 +12128,8 @@ defineFunction({
12255
12128
  };
12256
12129
  },
12257
12130
  htmlBuilder: (group, options) => {
12258
- var inner = makeSpan(["inner"], [buildGroup$1(group.body, options.withPhantom())]);
12259
- var fix = makeSpan(["fix"], []);
12131
+ var inner = makeSpan(["katex-inner"], [buildGroup$1(group.body, options.withPhantom())]);
12132
+ var fix = makeSpan(["katex-fix"], []);
12260
12133
  return makeSpan(["mord", "rlap"], [inner, fix], options);
12261
12134
  },
12262
12135
  mathmlBuilder: (group, options) => {
@@ -12276,9 +12149,7 @@ defineFunction({
12276
12149
  argTypes: ["size", "hbox"],
12277
12150
  allowedInText: true,
12278
12151
  handler(_ref, args) {
12279
- var {
12280
- parser
12281
- } = _ref;
12152
+ var parser = _ref.parser;
12282
12153
  var amount = assertNodeType(args[0], "size").value;
12283
12154
  var body = args[1];
12284
12155
  return {
@@ -12315,9 +12186,7 @@ defineFunction({
12315
12186
  allowedInText: true,
12316
12187
  allowedInArgument: true,
12317
12188
  handler(_ref) {
12318
- var {
12319
- parser
12320
- } = _ref;
12189
+ var parser = _ref.parser;
12321
12190
  return {
12322
12191
  type: "internal",
12323
12192
  mode: parser.mode
@@ -12334,9 +12203,7 @@ defineFunction({
12334
12203
  allowedInMath: true,
12335
12204
  argTypes: ["size", "size", "size"],
12336
12205
  handler(_ref, args, optArgs) {
12337
- var {
12338
- parser
12339
- } = _ref;
12206
+ var parser = _ref.parser;
12340
12207
  var shift = optArgs[0];
12341
12208
  var width = assertNodeType(args[0], "size");
12342
12209
  var height = assertNodeType(args[1], "size");
@@ -12350,7 +12217,7 @@ defineFunction({
12350
12217
  },
12351
12218
  htmlBuilder(group, options) {
12352
12219
  // Make an empty span for the rule
12353
- var rule = makeSpan(["mord", "rule"], [], options);
12220
+ var rule = makeSpan(["mord", "katex-rule"], [], options);
12354
12221
  // Calculate the shift, width, and height of the rule, and account for units
12355
12222
  var width = calculateSize(group.width, options);
12356
12223
  var height = calculateSize(group.height, options);
@@ -12396,7 +12263,7 @@ function sizingGroup(value, options, baseOptions) {
12396
12263
  // Add size-resetting classes to the inner list and set maxFontSize
12397
12264
  // manually. Handle nested size changes.
12398
12265
  for (var i = 0; i < inner.length; i++) {
12399
- var pos = inner[i].classes.indexOf("sizing");
12266
+ var pos = inner[i].classes.indexOf("katex-sizing");
12400
12267
  if (pos < 0) {
12401
12268
  Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));
12402
12269
  } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) {
@@ -12424,11 +12291,9 @@ defineFunction({
12424
12291
  numArgs: 0,
12425
12292
  allowedInText: true,
12426
12293
  handler: (_ref, args) => {
12427
- var {
12428
- breakOnTokenText,
12429
- funcName,
12430
- parser
12431
- } = _ref;
12294
+ var breakOnTokenText = _ref.breakOnTokenText,
12295
+ funcName = _ref.funcName,
12296
+ parser = _ref.parser;
12432
12297
  var body = parser.parseExpression(false, breakOnTokenText);
12433
12298
  return {
12434
12299
  type: "sizing",
@@ -12461,9 +12326,7 @@ defineFunction({
12461
12326
  numOptionalArgs: 1,
12462
12327
  allowedInText: true,
12463
12328
  handler: (_ref, args, optArgs) => {
12464
- var {
12465
- parser
12466
- } = _ref;
12329
+ var parser = _ref.parser;
12467
12330
  var smashHeight = false;
12468
12331
  var smashDepth = false;
12469
12332
  var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
@@ -12511,7 +12374,7 @@ defineFunction({
12511
12374
  }
12512
12375
  if (group.smashHeight && group.smashDepth) {
12513
12376
  // Symmetric \smash can stay in inline layout.
12514
- return makeSpan(["mord", "smash"], [node], options);
12377
+ return makeSpan(["mord", "katex-smash"], [node], options);
12515
12378
  }
12516
12379
  // In order to influence makeVList for asymmetric smashing, we have to
12517
12380
  // reset the children.
@@ -12557,9 +12420,7 @@ defineFunction({
12557
12420
  numArgs: 1,
12558
12421
  numOptionalArgs: 1,
12559
12422
  handler(_ref, args, optArgs) {
12560
- var {
12561
- parser
12562
- } = _ref;
12423
+ var parser = _ref.parser;
12563
12424
  var index = optArgs[0];
12564
12425
  var body = args[0];
12565
12426
  return {
@@ -12592,11 +12453,10 @@ defineFunction({
12592
12453
  var lineClearance = theta + phi / 4;
12593
12454
  var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta;
12594
12455
  // Create a sqrt SVG of the required minimum size
12595
- var {
12596
- span: img,
12597
- ruleWidth,
12598
- advanceWidth
12599
- } = makeSqrtImage(minDelimiterHeight, options);
12456
+ var _makeSqrtImage = makeSqrtImage(minDelimiterHeight, options),
12457
+ img = _makeSqrtImage.span,
12458
+ ruleWidth = _makeSqrtImage.ruleWidth,
12459
+ advanceWidth = _makeSqrtImage.advanceWidth;
12600
12460
  var delimDepth = img.height - ruleWidth;
12601
12461
  // Adjust the clearance based on the delimiter size
12602
12462
  if (delimDepth > inner.height + inner.depth + lineClearance) {
@@ -12644,15 +12504,13 @@ defineFunction({
12644
12504
  });
12645
12505
  // Add a class surrounding it so we can add on the appropriate
12646
12506
  // kerning
12647
- var rootVListWrap = makeSpan(["root"], [rootVList]);
12507
+ var rootVListWrap = makeSpan(["katex-root"], [rootVList]);
12648
12508
  return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
12649
12509
  }
12650
12510
  },
12651
12511
  mathmlBuilder(group, options) {
12652
- var {
12653
- body,
12654
- index
12655
- } = group;
12512
+ var body = group.body,
12513
+ index = group.index;
12656
12514
  return index ? new MathNode("mroot", [buildGroup(body, options), buildGroup(index, options)]) : new MathNode("msqrt", [buildGroup(body, options)]);
12657
12515
  }
12658
12516
  });
@@ -12673,11 +12531,9 @@ defineFunction({
12673
12531
  allowedInText: true,
12674
12532
  primitive: true,
12675
12533
  handler(_ref, args) {
12676
- var {
12677
- breakOnTokenText,
12678
- funcName,
12679
- parser
12680
- } = _ref;
12534
+ var breakOnTokenText = _ref.breakOnTokenText,
12535
+ funcName = _ref.funcName,
12536
+ parser = _ref.parser;
12681
12537
  // parse out the implicit body
12682
12538
  var body = parser.parseExpression(true, breakOnTokenText);
12683
12539
  // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.
@@ -12767,11 +12623,9 @@ defineFunctionBuilders({
12767
12623
  if (builderDelegate) {
12768
12624
  return builderDelegate(group, options);
12769
12625
  }
12770
- var {
12771
- base: valueBase,
12772
- sup: valueSup,
12773
- sub: valueSub
12774
- } = group;
12626
+ var valueBase = group.base,
12627
+ valueSup = group.sup,
12628
+ valueSub = group.sub;
12775
12629
  var base = buildGroup$1(valueBase, options);
12776
12630
  var supm;
12777
12631
  var subm;
@@ -13012,33 +12866,26 @@ defineFunctionBuilders({
13012
12866
  });
13013
12867
 
13014
12868
  // A map of CSS-based spacing functions to their CSS class.
13015
- var cssSpace = {
13016
- "\\nobreak": "nobreak",
13017
- "\\allowbreak": "allowbreak"
13018
- };
12869
+ var cssSpace = new Map([["\\nobreak", "nobreak"], ["\\allowbreak", "allowbreak"]]);
13019
12870
  // A lookup table to determine whether a spacing function/symbol should be
13020
12871
  // treated like a regular space character. If a symbol or command is a key
13021
12872
  // in this table, then it should be a regular space character. Furthermore,
13022
12873
  // the associated value may have a `className` specifying an extra CSS class
13023
12874
  // to add to the created `span`.
13024
- var regularSpace = {
13025
- " ": {},
13026
- "\\ ": {},
13027
- "~": {
13028
- className: "nobreak"
13029
- },
13030
- "\\space": {},
13031
- "\\nobreakspace": {
13032
- className: "nobreak"
13033
- }
13034
- };
12875
+ var regularSpace = new Map([[" ", {}], ["\\ ", {}], ["~", {
12876
+ className: "nobreak"
12877
+ }], ["\\space", {}], ["\\nobreakspace", {
12878
+ className: "nobreak"
12879
+ }]]);
13035
12880
  // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in
13036
12881
  // src/symbols.js.
13037
12882
  defineFunctionBuilders({
13038
12883
  type: "spacing",
13039
12884
  htmlBuilder(group, options) {
13040
- if (regularSpace.hasOwnProperty(group.text)) {
13041
- var className = regularSpace[group.text].className || "";
12885
+ var regularSpaceItem = regularSpace.get(group.text);
12886
+ var cssSpaceClass = cssSpace.get(group.text);
12887
+ if (regularSpaceItem) {
12888
+ var className = regularSpaceItem.className || "";
13042
12889
  // Spaces are generated by adding an actual space. Each of these
13043
12890
  // things has an entry in the symbols table, so these will be turned
13044
12891
  // into appropriate outputs.
@@ -13049,18 +12896,18 @@ defineFunctionBuilders({
13049
12896
  } else {
13050
12897
  return makeSpan(["mspace", className], [mathsym(group.text, group.mode, options)], options);
13051
12898
  }
13052
- } else if (cssSpace.hasOwnProperty(group.text)) {
12899
+ } else if (cssSpaceClass) {
13053
12900
  // Spaces based on just a CSS class.
13054
- return makeSpan(["mspace", cssSpace[group.text]], [], options);
12901
+ return makeSpan(["mspace", cssSpaceClass], [], options);
13055
12902
  } else {
13056
12903
  throw new ParseError("Unknown type of space \"" + group.text + "\"");
13057
12904
  }
13058
12905
  },
13059
12906
  mathmlBuilder(group, options) {
13060
12907
  var node;
13061
- if (regularSpace.hasOwnProperty(group.text)) {
12908
+ if (regularSpace.has(group.text)) {
13062
12909
  node = new MathNode("mtext", [new TextNode("\u00a0")]);
13063
- } else if (cssSpace.hasOwnProperty(group.text)) {
12910
+ } else if (cssSpace.has(group.text)) {
13064
12911
  // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
13065
12912
  return new MathNode("mspace");
13066
12913
  } else {
@@ -13135,10 +12982,8 @@ defineFunction({
13135
12982
  allowedInArgument: true,
13136
12983
  allowedInText: true,
13137
12984
  handler(_ref, args) {
13138
- var {
13139
- parser,
13140
- funcName
13141
- } = _ref;
12985
+ var parser = _ref.parser,
12986
+ funcName = _ref.funcName;
13142
12987
  var body = args[0];
13143
12988
  return {
13144
12989
  type: "text",
@@ -13164,9 +13009,7 @@ defineFunction({
13164
13009
  numArgs: 1,
13165
13010
  allowedInText: true,
13166
13011
  handler(_ref, args) {
13167
- var {
13168
- parser
13169
- } = _ref;
13012
+ var parser = _ref.parser;
13170
13013
  return {
13171
13014
  type: "underline",
13172
13015
  mode: parser.mode,
@@ -13198,7 +13041,7 @@ defineFunction({
13198
13041
  elem: innerGroup
13199
13042
  }]
13200
13043
  });
13201
- return makeSpan(["mord", "underline"], [vlist], options);
13044
+ return makeSpan(["mord", "katex-underline"], [vlist], options);
13202
13045
  },
13203
13046
  mathmlBuilder(group, options) {
13204
13047
  var operator = new MathNode("mo", [new TextNode("\u203e")]);
@@ -13218,9 +13061,7 @@ defineFunction({
13218
13061
  // In LaTeX, \vcenter can act only on a box.
13219
13062
  allowedInText: false,
13220
13063
  handler(_ref, args) {
13221
- var {
13222
- parser
13223
- } = _ref;
13064
+ var parser = _ref.parser;
13224
13065
  return {
13225
13066
  type: "vcenter",
13226
13067
  mode: parser.mode,
@@ -13443,13 +13284,11 @@ class Namespace {
13443
13284
  throw new ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug");
13444
13285
  }
13445
13286
  var undefs = this.undefStack.pop();
13446
- for (var undef in undefs) {
13447
- if (undefs.hasOwnProperty(undef)) {
13448
- if (undefs[undef] == null) {
13449
- delete this.current[undef];
13450
- } else {
13451
- this.current[undef] = undefs[undef];
13452
- }
13287
+ for (var key of Object.keys(undefs)) {
13288
+ if (undefs[key] === undefined) {
13289
+ delete this.current[key];
13290
+ } else {
13291
+ this.current[key] = undefs[key];
13453
13292
  }
13454
13293
  }
13455
13294
  }
@@ -13467,7 +13306,7 @@ class Namespace {
13467
13306
  * `get(name) != null`.
13468
13307
  */
13469
13308
  has(name) {
13470
- return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
13309
+ return Object.prototype.hasOwnProperty.call(this.current, name) || Object.prototype.hasOwnProperty.call(this.builtins, name);
13471
13310
  }
13472
13311
  /**
13473
13312
  * Get the current value of a name, or `undefined` if there is no value.
@@ -13478,7 +13317,7 @@ class Namespace {
13478
13317
  * `if (namespace.has(...))`.
13479
13318
  */
13480
13319
  get(name) {
13481
- if (this.current.hasOwnProperty(name)) {
13320
+ if (Object.prototype.hasOwnProperty.call(this.current, name)) {
13482
13321
  return this.current[name];
13483
13322
  } else {
13484
13323
  return this.builtins[name];
@@ -13511,7 +13350,7 @@ class Namespace {
13511
13350
  // unless an undo is already in place, in which case that older
13512
13351
  // value is the correct one.
13513
13352
  var top = this.undefStack[this.undefStack.length - 1];
13514
- if (top && !top.hasOwnProperty(name)) {
13353
+ if (top && !Object.prototype.hasOwnProperty.call(top, name)) {
13515
13354
  top[name] = this.current[name];
13516
13355
  }
13517
13356
  }
@@ -14526,16 +14365,14 @@ class MacroExpander {
14526
14365
  return null;
14527
14366
  }
14528
14367
  start = this.popToken(); // don't include [ in tokens
14529
- ({
14530
- tokens,
14531
- end
14532
- } = this.consumeArg(["]"]));
14368
+ var _this$consumeArg = this.consumeArg(["]"]);
14369
+ tokens = _this$consumeArg.tokens;
14370
+ end = _this$consumeArg.end;
14533
14371
  } else {
14534
- ({
14535
- tokens,
14536
- start,
14537
- end
14538
- } = this.consumeArg());
14372
+ var _this$consumeArg2 = this.consumeArg();
14373
+ tokens = _this$consumeArg2.tokens;
14374
+ start = _this$consumeArg2.start;
14375
+ end = _this$consumeArg2.end;
14539
14376
  }
14540
14377
  // indicate the end of an argument
14541
14378
  this.pushToken(new Token("EOF", end.loc));
@@ -14833,14 +14670,17 @@ class MacroExpander {
14833
14670
  * `implicitCommands`.
14834
14671
  */
14835
14672
  isDefined(name) {
14836
- return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
14673
+ return this.macros.has(name) || Object.prototype.hasOwnProperty.call(functions, name) || Object.prototype.hasOwnProperty.call(symbols.math, name) || Object.prototype.hasOwnProperty.call(symbols.text, name) || Object.prototype.hasOwnProperty.call(implicitCommands, name);
14837
14674
  }
14838
14675
  /**
14839
14676
  * Determine whether a command is expandable.
14840
14677
  */
14841
14678
  isExpandable(name) {
14842
14679
  var macro = this.macros.get(name);
14843
- return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : functions.hasOwnProperty(name) && !functions[name].primitive;
14680
+ if (macro != null) {
14681
+ return typeof macro === "string" || typeof macro === "function" || !macro.unexpandable;
14682
+ }
14683
+ return Object.prototype.hasOwnProperty.call(functions, name) && !functions[name].primitive;
14844
14684
  }
14845
14685
  }
14846
14686
 
@@ -15791,10 +15631,9 @@ class Parser {
15791
15631
  } else if (this.mode === "math" && funcData.allowedInMath === false) {
15792
15632
  throw new ParseError("Can't use function '" + func + "' in math mode", token);
15793
15633
  }
15794
- var {
15795
- args,
15796
- optArgs
15797
- } = this.parseArguments(func, funcData);
15634
+ var _this$parseArguments = this.parseArguments(func, funcData),
15635
+ args = _this$parseArguments.args,
15636
+ optArgs = _this$parseArguments.optArgs;
15798
15637
  return this.callFunction(func, args, optArgs, token, breakOnTokenText);
15799
15638
  }
15800
15639
  /**
@@ -16116,7 +15955,7 @@ class Parser {
16116
15955
  // If there exists a function with this name, parse the function.
16117
15956
  // Otherwise, just return a nucleus
16118
15957
  result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
16119
- if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) {
15958
+ if (result == null && text[0] === "\\" && !Object.prototype.hasOwnProperty.call(implicitCommands, text)) {
16120
15959
  if (this.settings.throwOnError) {
16121
15960
  throw new ParseError("Undefined control sequence: " + text, firstToken);
16122
15961
  }
@@ -16206,7 +16045,7 @@ class Parser {
16206
16045
  }
16207
16046
  // At this point, we should have a symbol, possibly with accents.
16208
16047
  // First expand any accented base symbol according to unicodeSymbols.
16209
- if (unicodeSymbols.hasOwnProperty(text[0]) && !symbols[this.mode][text[0]]) {
16048
+ if (Object.prototype.hasOwnProperty.call(unicodeSymbols, text[0]) && !symbols[this.mode][text[0]]) {
16210
16049
  // This behavior is not strict (XeTeX-compatible) in math mode.
16211
16050
  if (this.settings.strict && this.mode === "math") {
16212
16051
  this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
@@ -16406,7 +16245,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
16406
16245
  return renderError(error, expression, settings);
16407
16246
  }
16408
16247
  };
16409
- var version = "0.17.0";
16248
+ var version = "0.18.0";
16410
16249
  var __domTree = {
16411
16250
  Span,
16412
16251
  Anchor,