markmap-lib 0.17.3-alpha.1 → 0.17.3-alpha.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.
@@ -2646,7 +2646,7 @@
2646
2646
  function isQuote(c) {
2647
2647
  return c === 39 || c === 34;
2648
2648
  }
2649
- function isWhitespace$2(c) {
2649
+ function isWhitespace$3(c) {
2650
2650
  return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
2651
2651
  }
2652
2652
  function parse$5(selector) {
@@ -2670,7 +2670,7 @@
2670
2670
  }
2671
2671
  function stripWhitespace(offset) {
2672
2672
  selectorIndex += offset;
2673
- while (selectorIndex < selector.length && isWhitespace$2(selector.charCodeAt(selectorIndex))) {
2673
+ while (selectorIndex < selector.length && isWhitespace$3(selector.charCodeAt(selectorIndex))) {
2674
2674
  selectorIndex++;
2675
2675
  }
2676
2676
  }
@@ -2820,7 +2820,7 @@
2820
2820
  selectorIndex = sectionEnd + 1;
2821
2821
  } else {
2822
2822
  const valueStart = selectorIndex;
2823
- while (selectorIndex < selector.length && (!isWhitespace$2(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== 93 || isEscaped(selectorIndex))) {
2823
+ while (selectorIndex < selector.length && (!isWhitespace$3(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== 93 || isEscaped(selectorIndex))) {
2824
2824
  selectorIndex += 1;
2825
2825
  }
2826
2826
  value = unescapeCSS(selector.slice(valueStart, selectorIndex));
@@ -2937,6 +2937,7 @@
2937
2937
  finalizeSubselector();
2938
2938
  return selectorIndex;
2939
2939
  }
2940
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
2940
2941
  function getDefaultExportFromCjs(x) {
2941
2942
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
2942
2943
  }
@@ -5974,14 +5975,14 @@
5974
5975
  function toAsciiLower(cp) {
5975
5976
  return cp + 32;
5976
5977
  }
5977
- function isWhitespace$1(cp) {
5978
+ function isWhitespace$2(cp) {
5978
5979
  return cp === CODE_POINTS.SPACE || cp === CODE_POINTS.LINE_FEED || cp === CODE_POINTS.TABULATION || cp === CODE_POINTS.FORM_FEED;
5979
5980
  }
5980
5981
  function isEntityInAttributeInvalidEnd(nextCp) {
5981
5982
  return nextCp === CODE_POINTS.EQUALS_SIGN || isAsciiAlphaNumeric(nextCp);
5982
5983
  }
5983
5984
  function isScriptDataDoubleEscapeSequenceEnd(cp) {
5984
- return isWhitespace$1(cp) || cp === CODE_POINTS.SOLIDUS || cp === CODE_POINTS.GREATER_THAN_SIGN;
5985
+ return isWhitespace$2(cp) || cp === CODE_POINTS.SOLIDUS || cp === CODE_POINTS.GREATER_THAN_SIGN;
5985
5986
  }
5986
5987
  let Tokenizer$1 = class Tokenizer {
5987
5988
  constructor(options, handler) {
@@ -6272,7 +6273,7 @@
6272
6273
  this._createCharacterToken(type, ch);
6273
6274
  }
6274
6275
  _emitCodePoint(cp) {
6275
- const type = isWhitespace$1(cp) ? TokenType.WHITESPACE_CHARACTER : cp === CODE_POINTS.NULL ? TokenType.NULL_CHARACTER : TokenType.CHARACTER;
6276
+ const type = isWhitespace$2(cp) ? TokenType.WHITESPACE_CHARACTER : cp === CODE_POINTS.NULL ? TokenType.NULL_CHARACTER : TokenType.CHARACTER;
6276
6277
  this._appendCharToCurrentCharacterToken(type, String.fromCodePoint(cp));
6277
6278
  }
6278
6279
  //NOTE: used when we emit characters explicitly.
@@ -12864,11 +12865,11 @@
12864
12865
  State2[State2["InSpecialTag"] = 25] = "InSpecialTag";
12865
12866
  State2[State2["InEntity"] = 26] = "InEntity";
12866
12867
  })(State || (State = {}));
12867
- function isWhitespace(c) {
12868
+ function isWhitespace$1(c) {
12868
12869
  return c === CharCodes.Space || c === CharCodes.NewLine || c === CharCodes.Tab || c === CharCodes.FormFeed || c === CharCodes.CarriageReturn;
12869
12870
  }
12870
12871
  function isEndOfTagSection(c) {
12871
- return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);
12872
+ return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace$1(c);
12872
12873
  }
12873
12874
  function isASCIIAlpha(c) {
12874
12875
  return c >= CharCodes.LowerA && c <= CharCodes.LowerZ || c >= CharCodes.UpperA && c <= CharCodes.UpperZ;
@@ -12986,7 +12987,7 @@
12986
12987
  /** Look for an end tag. For <title> tags, also decode entities. */
12987
12988
  stateInSpecialTag(c) {
12988
12989
  if (this.sequenceIndex === this.currentSequence.length) {
12989
- if (c === CharCodes.Gt || isWhitespace(c)) {
12990
+ if (c === CharCodes.Gt || isWhitespace$1(c)) {
12990
12991
  const endOfText = this.index - this.currentSequence.length;
12991
12992
  if (this.sectionStart < endOfText) {
12992
12993
  const actualIndex = this.index;
@@ -13122,7 +13123,7 @@
13122
13123
  }
13123
13124
  }
13124
13125
  stateBeforeClosingTagName(c) {
13125
- if (isWhitespace(c)) ;
13126
+ if (isWhitespace$1(c)) ;
13126
13127
  else if (c === CharCodes.Gt) {
13127
13128
  this.state = State.Text;
13128
13129
  } else {
@@ -13131,7 +13132,7 @@
13131
13132
  }
13132
13133
  }
13133
13134
  stateInClosingTagName(c) {
13134
- if (c === CharCodes.Gt || isWhitespace(c)) {
13135
+ if (c === CharCodes.Gt || isWhitespace$1(c)) {
13135
13136
  this.cbs.onclosetag(this.sectionStart, this.index);
13136
13137
  this.sectionStart = -1;
13137
13138
  this.state = State.AfterClosingTagName;
@@ -13156,7 +13157,7 @@
13156
13157
  this.sectionStart = this.index + 1;
13157
13158
  } else if (c === CharCodes.Slash) {
13158
13159
  this.state = State.InSelfClosingTag;
13159
- } else if (!isWhitespace(c)) {
13160
+ } else if (!isWhitespace$1(c)) {
13160
13161
  this.state = State.InAttributeName;
13161
13162
  this.sectionStart = this.index;
13162
13163
  }
@@ -13167,7 +13168,7 @@
13167
13168
  this.state = State.Text;
13168
13169
  this.sectionStart = this.index + 1;
13169
13170
  this.isSpecial = false;
13170
- } else if (!isWhitespace(c)) {
13171
+ } else if (!isWhitespace$1(c)) {
13171
13172
  this.state = State.BeforeAttributeName;
13172
13173
  this.stateBeforeAttributeName(c);
13173
13174
  }
@@ -13188,7 +13189,7 @@
13188
13189
  this.sectionStart = -1;
13189
13190
  this.state = State.BeforeAttributeName;
13190
13191
  this.stateBeforeAttributeName(c);
13191
- } else if (!isWhitespace(c)) {
13192
+ } else if (!isWhitespace$1(c)) {
13192
13193
  this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
13193
13194
  this.state = State.InAttributeName;
13194
13195
  this.sectionStart = this.index;
@@ -13201,7 +13202,7 @@
13201
13202
  } else if (c === CharCodes.SingleQuote) {
13202
13203
  this.state = State.InAttributeValueSq;
13203
13204
  this.sectionStart = this.index + 1;
13204
- } else if (!isWhitespace(c)) {
13205
+ } else if (!isWhitespace$1(c)) {
13205
13206
  this.sectionStart = this.index;
13206
13207
  this.state = State.InAttributeValueNq;
13207
13208
  this.stateInAttributeValueNoQuotes(c);
@@ -13224,7 +13225,7 @@
13224
13225
  this.handleInAttributeValue(c, CharCodes.SingleQuote);
13225
13226
  }
13226
13227
  stateInAttributeValueNoQuotes(c) {
13227
- if (isWhitespace(c) || c === CharCodes.Gt) {
13228
+ if (isWhitespace$1(c) || c === CharCodes.Gt) {
13228
13229
  this.cbs.onattribdata(this.sectionStart, this.index);
13229
13230
  this.sectionStart = -1;
13230
13231
  this.cbs.onattribend(QuoteType.Unquoted, this.index);
@@ -14090,6 +14091,16 @@
14090
14091
  skippingHeading = 0;
14091
14092
  const isHeading = level <= 6;
14092
14093
  let data2 = $child.data();
14094
+ let html22 = result.html || "";
14095
+ if ($child.is("ol>li") && (node == null ? void 0 : node.children)) {
14096
+ const start = +($child.parent().attr("start") || 1);
14097
+ const listIndex = start + node.children.length;
14098
+ html22 = `${listIndex}. ${html22}`;
14099
+ data2 = {
14100
+ ...data2,
14101
+ listIndex
14102
+ };
14103
+ }
14093
14104
  if ($child.children("code:only-child").length) {
14094
14105
  data2 = {
14095
14106
  ...data2,
@@ -14101,7 +14112,7 @@
14101
14112
  nesting: !!result.queue || isHeading,
14102
14113
  tagName: child.tagName,
14103
14114
  level,
14104
- html: result.html || "",
14115
+ html: html22,
14105
14116
  comments: result.comments,
14106
14117
  data: data2
14107
14118
  });
@@ -15047,9 +15058,9 @@
15047
15058
  return -1;
15048
15059
  };
15049
15060
  Ruler.prototype.__compile__ = function() {
15050
- const self = this;
15061
+ const self2 = this;
15051
15062
  const chains = [""];
15052
- self.__rules__.forEach(function(rule) {
15063
+ self2.__rules__.forEach(function(rule) {
15053
15064
  if (!rule.enabled) {
15054
15065
  return;
15055
15066
  }
@@ -15059,17 +15070,17 @@
15059
15070
  }
15060
15071
  });
15061
15072
  });
15062
- self.__cache__ = {};
15073
+ self2.__cache__ = {};
15063
15074
  chains.forEach(function(chain) {
15064
- self.__cache__[chain] = [];
15065
- self.__rules__.forEach(function(rule) {
15075
+ self2.__cache__[chain] = [];
15076
+ self2.__rules__.forEach(function(rule) {
15066
15077
  if (!rule.enabled) {
15067
15078
  return;
15068
15079
  }
15069
15080
  if (chain && rule.alt.indexOf(chain) < 0) {
15070
15081
  return;
15071
15082
  }
15072
- self.__cache__[chain].push(rule.fn);
15083
+ self2.__cache__[chain].push(rule.fn);
15073
15084
  });
15074
15085
  });
15075
15086
  };
@@ -18014,16 +18025,16 @@
18014
18025
  }
18015
18026
  const defaultSchemas = {
18016
18027
  "http:": {
18017
- validate: function(text2, pos, self) {
18028
+ validate: function(text2, pos, self2) {
18018
18029
  const tail = text2.slice(pos);
18019
- if (!self.re.http) {
18020
- self.re.http = new RegExp(
18021
- "^\\/\\/" + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path,
18030
+ if (!self2.re.http) {
18031
+ self2.re.http = new RegExp(
18032
+ "^\\/\\/" + self2.re.src_auth + self2.re.src_host_port_strict + self2.re.src_path,
18022
18033
  "i"
18023
18034
  );
18024
18035
  }
18025
- if (self.re.http.test(tail)) {
18026
- return tail.match(self.re.http)[0].length;
18036
+ if (self2.re.http.test(tail)) {
18037
+ return tail.match(self2.re.http)[0].length;
18027
18038
  }
18028
18039
  return 0;
18029
18040
  }
@@ -18031,39 +18042,39 @@
18031
18042
  "https:": "http:",
18032
18043
  "ftp:": "http:",
18033
18044
  "//": {
18034
- validate: function(text2, pos, self) {
18045
+ validate: function(text2, pos, self2) {
18035
18046
  const tail = text2.slice(pos);
18036
- if (!self.re.no_http) {
18037
- self.re.no_http = new RegExp(
18038
- "^" + self.re.src_auth + // Don't allow single-level domains, because of false positives like '//test'
18047
+ if (!self2.re.no_http) {
18048
+ self2.re.no_http = new RegExp(
18049
+ "^" + self2.re.src_auth + // Don't allow single-level domains, because of false positives like '//test'
18039
18050
  // with code comments
18040
- "(?:localhost|(?:(?:" + self.re.src_domain + ")\\.)+" + self.re.src_domain_root + ")" + self.re.src_port + self.re.src_host_terminator + self.re.src_path,
18051
+ "(?:localhost|(?:(?:" + self2.re.src_domain + ")\\.)+" + self2.re.src_domain_root + ")" + self2.re.src_port + self2.re.src_host_terminator + self2.re.src_path,
18041
18052
  "i"
18042
18053
  );
18043
18054
  }
18044
- if (self.re.no_http.test(tail)) {
18055
+ if (self2.re.no_http.test(tail)) {
18045
18056
  if (pos >= 3 && text2[pos - 3] === ":") {
18046
18057
  return 0;
18047
18058
  }
18048
18059
  if (pos >= 3 && text2[pos - 3] === "/") {
18049
18060
  return 0;
18050
18061
  }
18051
- return tail.match(self.re.no_http)[0].length;
18062
+ return tail.match(self2.re.no_http)[0].length;
18052
18063
  }
18053
18064
  return 0;
18054
18065
  }
18055
18066
  },
18056
18067
  "mailto:": {
18057
- validate: function(text2, pos, self) {
18068
+ validate: function(text2, pos, self2) {
18058
18069
  const tail = text2.slice(pos);
18059
- if (!self.re.mailto) {
18060
- self.re.mailto = new RegExp(
18061
- "^" + self.re.src_email_name + "@" + self.re.src_host_strict,
18070
+ if (!self2.re.mailto) {
18071
+ self2.re.mailto = new RegExp(
18072
+ "^" + self2.re.src_email_name + "@" + self2.re.src_host_strict,
18062
18073
  "i"
18063
18074
  );
18064
18075
  }
18065
- if (self.re.mailto.test(tail)) {
18066
- return tail.match(self.re.mailto)[0].length;
18076
+ if (self2.re.mailto.test(tail)) {
18077
+ return tail.match(self2.re.mailto)[0].length;
18067
18078
  }
18068
18079
  return 0;
18069
18080
  }
@@ -18071,9 +18082,9 @@
18071
18082
  };
18072
18083
  const tlds_2ch_src_re = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]";
18073
18084
  const tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");
18074
- function resetScanCache(self) {
18075
- self.__index__ = -1;
18076
- self.__text_cache__ = "";
18085
+ function resetScanCache(self2) {
18086
+ self2.__index__ = -1;
18087
+ self2.__text_cache__ = "";
18077
18088
  }
18078
18089
  function createValidator(re) {
18079
18090
  return function(text2, pos) {
@@ -18085,15 +18096,15 @@
18085
18096
  };
18086
18097
  }
18087
18098
  function createNormalizer() {
18088
- return function(match, self) {
18089
- self.normalize(match);
18099
+ return function(match, self2) {
18100
+ self2.normalize(match);
18090
18101
  };
18091
18102
  }
18092
- function compile(self) {
18093
- const re = self.re = reFactory(self.__opts__);
18094
- const tlds = self.__tlds__.slice();
18095
- self.onCompile();
18096
- if (!self.__tlds_replaced__) {
18103
+ function compile(self2) {
18104
+ const re = self2.re = reFactory(self2.__opts__);
18105
+ const tlds = self2.__tlds__.slice();
18106
+ self2.onCompile();
18107
+ if (!self2.__tlds_replaced__) {
18097
18108
  tlds.push(tlds_2ch_src_re);
18098
18109
  }
18099
18110
  tlds.push(re.src_xn);
@@ -18106,17 +18117,17 @@
18106
18117
  re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i");
18107
18118
  re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i");
18108
18119
  const aliases2 = [];
18109
- self.__compiled__ = {};
18120
+ self2.__compiled__ = {};
18110
18121
  function schemaError(name2, val2) {
18111
18122
  throw new Error('(LinkifyIt) Invalid schema "' + name2 + '": ' + val2);
18112
18123
  }
18113
- Object.keys(self.__schemas__).forEach(function(name2) {
18114
- const val2 = self.__schemas__[name2];
18124
+ Object.keys(self2.__schemas__).forEach(function(name2) {
18125
+ const val2 = self2.__schemas__[name2];
18115
18126
  if (val2 === null) {
18116
18127
  return;
18117
18128
  }
18118
18129
  const compiled = { validate: null, link: null };
18119
- self.__compiled__[name2] = compiled;
18130
+ self2.__compiled__[name2] = compiled;
18120
18131
  if (isObject(val2)) {
18121
18132
  if (isRegExp(val2.validate)) {
18122
18133
  compiled.validate = createValidator(val2.validate);
@@ -18141,39 +18152,39 @@
18141
18152
  schemaError(name2, val2);
18142
18153
  });
18143
18154
  aliases2.forEach(function(alias) {
18144
- if (!self.__compiled__[self.__schemas__[alias]]) {
18155
+ if (!self2.__compiled__[self2.__schemas__[alias]]) {
18145
18156
  return;
18146
18157
  }
18147
- self.__compiled__[alias].validate = self.__compiled__[self.__schemas__[alias]].validate;
18148
- self.__compiled__[alias].normalize = self.__compiled__[self.__schemas__[alias]].normalize;
18158
+ self2.__compiled__[alias].validate = self2.__compiled__[self2.__schemas__[alias]].validate;
18159
+ self2.__compiled__[alias].normalize = self2.__compiled__[self2.__schemas__[alias]].normalize;
18149
18160
  });
18150
- self.__compiled__[""] = { validate: null, normalize: createNormalizer() };
18151
- const slist = Object.keys(self.__compiled__).filter(function(name2) {
18152
- return name2.length > 0 && self.__compiled__[name2];
18161
+ self2.__compiled__[""] = { validate: null, normalize: createNormalizer() };
18162
+ const slist = Object.keys(self2.__compiled__).filter(function(name2) {
18163
+ return name2.length > 0 && self2.__compiled__[name2];
18153
18164
  }).map(escapeRE).join("|");
18154
- self.re.schema_test = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "i");
18155
- self.re.schema_search = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "ig");
18156
- self.re.schema_at_start = RegExp("^" + self.re.schema_search.source, "i");
18157
- self.re.pretest = RegExp(
18158
- "(" + self.re.schema_test.source + ")|(" + self.re.host_fuzzy_test.source + ")|@",
18165
+ self2.re.schema_test = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "i");
18166
+ self2.re.schema_search = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "ig");
18167
+ self2.re.schema_at_start = RegExp("^" + self2.re.schema_search.source, "i");
18168
+ self2.re.pretest = RegExp(
18169
+ "(" + self2.re.schema_test.source + ")|(" + self2.re.host_fuzzy_test.source + ")|@",
18159
18170
  "i"
18160
18171
  );
18161
- resetScanCache(self);
18172
+ resetScanCache(self2);
18162
18173
  }
18163
- function Match(self, shift) {
18164
- const start = self.__index__;
18165
- const end2 = self.__last_index__;
18166
- const text2 = self.__text_cache__.slice(start, end2);
18167
- this.schema = self.__schema__.toLowerCase();
18174
+ function Match(self2, shift) {
18175
+ const start = self2.__index__;
18176
+ const end2 = self2.__last_index__;
18177
+ const text2 = self2.__text_cache__.slice(start, end2);
18178
+ this.schema = self2.__schema__.toLowerCase();
18168
18179
  this.index = start + shift;
18169
18180
  this.lastIndex = end2 + shift;
18170
18181
  this.raw = text2;
18171
18182
  this.text = text2;
18172
18183
  this.url = text2;
18173
18184
  }
18174
- function createMatch(self, shift) {
18175
- const match = new Match(self, shift);
18176
- self.__compiled__[match.schema].normalize(match, self);
18185
+ function createMatch(self2, shift) {
18186
+ const match = new Match(self2, shift);
18187
+ self2.__compiled__[match.schema].normalize(match, self2);
18177
18188
  return match;
18178
18189
  }
18179
18190
  function LinkifyIt(schemas2, options) {
@@ -18788,7 +18799,7 @@
18788
18799
  return this;
18789
18800
  };
18790
18801
  MarkdownIt.prototype.configure = function(presets) {
18791
- const self = this;
18802
+ const self2 = this;
18792
18803
  if (isString$1(presets)) {
18793
18804
  const presetName = presets;
18794
18805
  presets = config$2[presetName];
@@ -18800,15 +18811,15 @@
18800
18811
  throw new Error("Wrong `markdown-it` preset, can't be empty");
18801
18812
  }
18802
18813
  if (presets.options) {
18803
- self.set(presets.options);
18814
+ self2.set(presets.options);
18804
18815
  }
18805
18816
  if (presets.components) {
18806
18817
  Object.keys(presets.components).forEach(function(name2) {
18807
18818
  if (presets.components[name2].rules) {
18808
- self[name2].ruler.enableOnly(presets.components[name2].rules);
18819
+ self2[name2].ruler.enableOnly(presets.components[name2].rules);
18809
18820
  }
18810
18821
  if (presets.components[name2].rules2) {
18811
- self[name2].ruler2.enableOnly(presets.components[name2].rules2);
18822
+ self2[name2].ruler2.enableOnly(presets.components[name2].rules2);
18812
18823
  }
18813
18824
  });
18814
18825
  }
@@ -25270,28 +25281,56 @@ ${end2.comment}` : end2.comment;
25270
25281
  };
25271
25282
  }
25272
25283
  });
25273
- var katex = require$$0;
25274
- function isValidDelim(state, pos) {
25275
- var prevChar, nextChar, max = state.posMax, can_open = true, can_close = true;
25276
- prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
25277
- nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
25278
- if (prevChar === 32 || prevChar === 9 || nextChar >= 48 && nextChar <= 57) {
25279
- can_close = false;
25280
- }
25281
- if (nextChar === 32 || nextChar === 9) {
25282
- can_open = false;
25283
- }
25284
- return {
25285
- can_open,
25286
- can_close
25287
- };
25288
- }
25289
- function math_inline(state, silent) {
25290
- var start, match, token, res, pos;
25284
+ var dist = {};
25285
+ var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) {
25286
+ return mod && mod.__esModule ? mod : { "default": mod };
25287
+ };
25288
+ Object.defineProperty(dist, "__esModule", { value: true });
25289
+ const katex_1 = __importDefault(require$$0);
25290
+ function isValidInlineDelim(state, pos) {
25291
+ const prevChar = state.src[pos - 1];
25292
+ const char = state.src[pos];
25293
+ const nextChar = state.src[pos + 1];
25294
+ if (char !== "$") {
25295
+ return { can_open: false, can_close: false };
25296
+ }
25297
+ let canOpen = false;
25298
+ let canClose = false;
25299
+ if (prevChar !== "$" && prevChar !== "\\" && (prevChar === void 0 || isWhitespace(prevChar) || !isWordCharacterOrNumber(prevChar))) {
25300
+ canOpen = true;
25301
+ }
25302
+ if (nextChar !== "$" && (nextChar == void 0 || isWhitespace(nextChar) || !isWordCharacterOrNumber(nextChar))) {
25303
+ canClose = true;
25304
+ }
25305
+ return { can_open: canOpen, can_close: canClose };
25306
+ }
25307
+ function isWhitespace(char) {
25308
+ return /^\s$/u.test(char);
25309
+ }
25310
+ function isWordCharacterOrNumber(char) {
25311
+ return /^[\w\d]$/u.test(char);
25312
+ }
25313
+ function isValidBlockDelim(state, pos) {
25314
+ const prevChar = state.src[pos - 1];
25315
+ const char = state.src[pos];
25316
+ const nextChar = state.src[pos + 1];
25317
+ const nextCharPlus1 = state.src[pos + 2];
25318
+ if (char === "$" && prevChar !== "$" && prevChar !== "\\" && nextChar === "$" && nextCharPlus1 !== "$") {
25319
+ return { can_open: true, can_close: true };
25320
+ }
25321
+ return { can_open: false, can_close: false };
25322
+ }
25323
+ function inlineMath(state, silent) {
25291
25324
  if (state.src[state.pos] !== "$") {
25292
25325
  return false;
25293
25326
  }
25294
- res = isValidDelim(state, state.pos);
25327
+ const lastToken = state.tokens.at(-1);
25328
+ if ((lastToken == null ? void 0 : lastToken.type) === "html_inline") {
25329
+ if (/^<\w+.+[^/]>$/.test(lastToken.content)) {
25330
+ return false;
25331
+ }
25332
+ }
25333
+ let res = isValidInlineDelim(state, state.pos);
25295
25334
  if (!res.can_open) {
25296
25335
  if (!silent) {
25297
25336
  state.pending += "$";
@@ -25299,8 +25338,9 @@ ${end2.comment}` : end2.comment;
25299
25338
  state.pos += 1;
25300
25339
  return true;
25301
25340
  }
25302
- start = state.pos + 1;
25303
- match = start;
25341
+ let start = state.pos + 1;
25342
+ let match = start;
25343
+ let pos;
25304
25344
  while ((match = state.src.indexOf("$", match)) !== -1) {
25305
25345
  pos = match - 1;
25306
25346
  while (state.src[pos] === "\\") {
@@ -25325,7 +25365,7 @@ ${end2.comment}` : end2.comment;
25325
25365
  state.pos = start + 1;
25326
25366
  return true;
25327
25367
  }
25328
- res = isValidDelim(state, match);
25368
+ res = isValidInlineDelim(state, match);
25329
25369
  if (!res.can_close) {
25330
25370
  if (!silent) {
25331
25371
  state.pending += "$";
@@ -25334,15 +25374,15 @@ ${end2.comment}` : end2.comment;
25334
25374
  return true;
25335
25375
  }
25336
25376
  if (!silent) {
25337
- token = state.push("math_inline", "math", 0);
25377
+ const token = state.push("math_inline", "math", 0);
25338
25378
  token.markup = "$";
25339
25379
  token.content = state.src.slice(start, match);
25340
25380
  }
25341
25381
  state.pos = match + 1;
25342
25382
  return true;
25343
25383
  }
25344
- function math_block(state, start, end2, silent) {
25345
- var firstLine, lastLine, next2, lastPos, found = false, token, pos = state.bMarks[start] + state.tShift[start], max = state.eMarks[start];
25384
+ function blockMath(state, start, end2, silent) {
25385
+ var lastLine, next2, lastPos, found = false, token, pos = state.bMarks[start] + state.tShift[start], max = state.eMarks[start];
25346
25386
  if (pos + 2 > max) {
25347
25387
  return false;
25348
25388
  }
@@ -25350,7 +25390,7 @@ ${end2.comment}` : end2.comment;
25350
25390
  return false;
25351
25391
  }
25352
25392
  pos += 2;
25353
- firstLine = state.src.slice(pos, max);
25393
+ let firstLine = state.src.slice(pos, max);
25354
25394
  if (silent) {
25355
25395
  return true;
25356
25396
  }
@@ -25372,6 +25412,10 @@ ${end2.comment}` : end2.comment;
25372
25412
  lastPos = state.src.slice(0, max).lastIndexOf("$$");
25373
25413
  lastLine = state.src.slice(pos, lastPos);
25374
25414
  found = true;
25415
+ } else if (state.src.slice(pos, max).trim().includes("$$")) {
25416
+ lastPos = state.src.slice(0, max).trim().indexOf("$$");
25417
+ lastLine = state.src.slice(pos, lastPos);
25418
+ found = true;
25375
25419
  }
25376
25420
  }
25377
25421
  state.line = next2 + 1;
@@ -25382,47 +25426,271 @@ ${end2.comment}` : end2.comment;
25382
25426
  token.markup = "$$";
25383
25427
  return true;
25384
25428
  }
25429
+ function blockBareMath(state, start, end2, silent) {
25430
+ const startPos = state.bMarks[start] + state.tShift[start];
25431
+ const startMax = state.eMarks[start];
25432
+ const firstLine = state.src.slice(startPos, startMax);
25433
+ const beginMatch = firstLine.match(/^\s*\\begin\s*\{([^{}]+)\}/);
25434
+ if (!beginMatch) {
25435
+ return false;
25436
+ }
25437
+ if (start > 0) {
25438
+ const previousStart = state.bMarks[start - 1] + state.tShift[start - 1];
25439
+ const previousEnd = state.eMarks[start - 1];
25440
+ const previousLine = state.src.slice(previousStart, previousEnd);
25441
+ if (!/^\s*$/.test(previousLine)) {
25442
+ return false;
25443
+ }
25444
+ }
25445
+ if (silent) {
25446
+ return true;
25447
+ }
25448
+ const beginEndStack = [];
25449
+ let next2 = start;
25450
+ let lastLine;
25451
+ let found = false;
25452
+ outer: for (; !found; next2++) {
25453
+ if (next2 >= end2) {
25454
+ break;
25455
+ }
25456
+ const pos = state.bMarks[next2] + state.tShift[next2];
25457
+ const max = state.eMarks[next2];
25458
+ if (pos < max && state.tShift[next2] < state.blkIndent) {
25459
+ break;
25460
+ }
25461
+ const line = state.src.slice(pos, max);
25462
+ for (const match of line.matchAll(/(\\begin|\\end)\s*\{([^{}]+)\}/g)) {
25463
+ if (match[1] === "\\begin") {
25464
+ beginEndStack.push(match[2].trim());
25465
+ } else if (match[1] === "\\end") {
25466
+ beginEndStack.pop();
25467
+ if (!beginEndStack.length) {
25468
+ lastLine = state.src.slice(pos, max);
25469
+ found = true;
25470
+ break outer;
25471
+ }
25472
+ }
25473
+ }
25474
+ }
25475
+ state.line = next2 + 1;
25476
+ const token = state.push("math_block", "math", 0);
25477
+ token.block = true;
25478
+ token.content = (state.getLines(start, next2, state.tShift[start], true) + (lastLine ?? "")).trim();
25479
+ token.map = [start, state.line];
25480
+ token.markup = "$$";
25481
+ return true;
25482
+ }
25483
+ function inlineMathBlock(state, silent) {
25484
+ var start, match, token, res, pos;
25485
+ if (state.src.slice(state.pos, state.pos + 2) !== "$$") {
25486
+ return false;
25487
+ }
25488
+ res = isValidBlockDelim(state, state.pos);
25489
+ if (!res.can_open) {
25490
+ if (!silent) {
25491
+ state.pending += "$$";
25492
+ }
25493
+ state.pos += 2;
25494
+ return true;
25495
+ }
25496
+ start = state.pos + 2;
25497
+ match = start;
25498
+ while ((match = state.src.indexOf("$$", match)) !== -1) {
25499
+ pos = match - 1;
25500
+ while (state.src[pos] === "\\") {
25501
+ pos -= 1;
25502
+ }
25503
+ if ((match - pos) % 2 == 1) {
25504
+ break;
25505
+ }
25506
+ match += 2;
25507
+ }
25508
+ if (match === -1) {
25509
+ if (!silent) {
25510
+ state.pending += "$$";
25511
+ }
25512
+ state.pos = start;
25513
+ return true;
25514
+ }
25515
+ if (match - start === 0) {
25516
+ if (!silent) {
25517
+ state.pending += "$$$$";
25518
+ }
25519
+ state.pos = start + 2;
25520
+ return true;
25521
+ }
25522
+ res = isValidBlockDelim(state, match);
25523
+ if (!res.can_close) {
25524
+ if (!silent) {
25525
+ state.pending += "$$";
25526
+ }
25527
+ state.pos = start;
25528
+ return true;
25529
+ }
25530
+ if (!silent) {
25531
+ token = state.push("math_block", "math", 0);
25532
+ token.block = true;
25533
+ token.markup = "$$";
25534
+ token.content = state.src.slice(start, match);
25535
+ }
25536
+ state.pos = match + 2;
25537
+ return true;
25538
+ }
25539
+ function inlineBareBlock(state, silent) {
25540
+ const text2 = state.src.slice(state.pos);
25541
+ if (!/^\n\\begin/.test(text2)) {
25542
+ return false;
25543
+ }
25544
+ state.pos += 1;
25545
+ if (silent) {
25546
+ return true;
25547
+ }
25548
+ const lines = text2.split(/\n/g).slice(1);
25549
+ let foundLine;
25550
+ const beginEndStack = [];
25551
+ outer: for (var i = 0; i < lines.length; ++i) {
25552
+ const line = lines[i];
25553
+ for (const match of line.matchAll(/(\\begin|\\end)\s*\{([^{}]+)\}/g)) {
25554
+ if (match[1] === "\\begin") {
25555
+ beginEndStack.push(match[2].trim());
25556
+ } else if (match[1] === "\\end") {
25557
+ beginEndStack.pop();
25558
+ if (!beginEndStack.length) {
25559
+ foundLine = i;
25560
+ break outer;
25561
+ }
25562
+ }
25563
+ }
25564
+ }
25565
+ if (typeof foundLine === "undefined") {
25566
+ return false;
25567
+ }
25568
+ const endIndex = lines.slice(0, foundLine + 1).reduce((p, c) => p + c.length, 0) + foundLine + 1;
25569
+ const token = state.push("math_inline_bare_block", "math", 0);
25570
+ token.block = true;
25571
+ token.markup = "$$";
25572
+ token.content = text2.slice(1, endIndex);
25573
+ state.pos = state.pos + endIndex;
25574
+ return true;
25575
+ }
25576
+ function handleMathInHtml(state, mathType, mathMarkup, mathRegex) {
25577
+ const tokens = state.tokens;
25578
+ for (let index2 = tokens.length - 1; index2 >= 0; index2--) {
25579
+ const currentToken = tokens[index2];
25580
+ const newTokens = [];
25581
+ if (currentToken.type !== "html_block") {
25582
+ continue;
25583
+ }
25584
+ const content = currentToken.content;
25585
+ for (const match of content.matchAll(mathRegex)) {
25586
+ if (!match.groups) {
25587
+ continue;
25588
+ }
25589
+ const html_before_math = match.groups.html_before_math;
25590
+ const math = match.groups.math;
25591
+ const html_after_math = match.groups.html_after_math;
25592
+ if (html_before_math) {
25593
+ newTokens.push({ ...currentToken, type: "html_block", map: null, content: html_before_math });
25594
+ }
25595
+ if (math) {
25596
+ newTokens.push({
25597
+ ...currentToken,
25598
+ type: mathType,
25599
+ map: null,
25600
+ content: math,
25601
+ markup: mathMarkup,
25602
+ block: true,
25603
+ tag: "math"
25604
+ });
25605
+ }
25606
+ if (html_after_math) {
25607
+ newTokens.push({ ...currentToken, type: "html_block", map: null, content: html_after_math });
25608
+ }
25609
+ }
25610
+ if (newTokens.length > 0) {
25611
+ tokens.splice(index2, 1, ...newTokens);
25612
+ }
25613
+ }
25614
+ return true;
25615
+ }
25385
25616
  function escapeHtml(unsafe) {
25386
25617
  return unsafe.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
25387
25618
  }
25388
- var markdownItKatex = function math_plugin(md, options) {
25389
- options = options || {};
25390
- var katexInline = function(latex) {
25391
- options.displayMode = false;
25619
+ function default_1(md, options) {
25620
+ const enableBareBlocks = options == null ? void 0 : options.enableBareBlocks;
25621
+ const enableMathBlockInHtml = options == null ? void 0 : options.enableMathBlockInHtml;
25622
+ const enableMathInlineInHtml = options == null ? void 0 : options.enableMathInlineInHtml;
25623
+ const enableFencedBlocks = options == null ? void 0 : options.enableFencedBlocks;
25624
+ md.inline.ruler.after("escape", "math_inline", inlineMath);
25625
+ md.inline.ruler.after("escape", "math_inline_block", inlineMathBlock);
25626
+ if (enableBareBlocks) {
25627
+ md.inline.ruler.before("text", "math_inline_bare_block", inlineBareBlock);
25628
+ }
25629
+ md.block.ruler.after("blockquote", "math_block", (state, start, end2, silent) => {
25630
+ if (enableBareBlocks && blockBareMath(state, start, end2, silent)) {
25631
+ return true;
25632
+ }
25633
+ return blockMath(state, start, end2, silent);
25634
+ }, {
25635
+ alt: ["paragraph", "reference", "blockquote", "list"]
25636
+ });
25637
+ const math_block_within_html_regex = /(?<html_before_math>[\s\S]*?)\$\$(?<math>[\s\S]+?)\$\$(?<html_after_math>(?:(?!\$\$[\s\S]+?\$\$)[\s\S])*)/gm;
25638
+ const math_inline_within_html_regex = /(?<html_before_math>[\s\S]*?)\$(?<math>.*?)\$(?<html_after_math>(?:(?!\$.*?\$)[\s\S])*)/gm;
25639
+ if (enableMathBlockInHtml) {
25640
+ md.core.ruler.push("math_block_in_html_block", (state) => {
25641
+ return handleMathInHtml(state, "math_block", "$$", math_block_within_html_regex);
25642
+ });
25643
+ }
25644
+ if (enableMathInlineInHtml) {
25645
+ md.core.ruler.push("math_inline_in_html_block", (state) => {
25646
+ return handleMathInHtml(state, "math_inline", "$", math_inline_within_html_regex);
25647
+ });
25648
+ }
25649
+ const katexInline = (latex) => {
25650
+ const displayMode = /\\begin\{(align|equation|gather|cd|alignat)\}/ig.test(latex);
25392
25651
  try {
25393
- return katex.renderToString(latex, options);
25652
+ return katex_1.default.renderToString(latex, { ...options, displayMode });
25394
25653
  } catch (error2) {
25395
- if (options.throwOnError) {
25654
+ if (options == null ? void 0 : options.throwOnError) {
25396
25655
  console.log(error2);
25397
25656
  }
25398
- return `<span class='katex-error' title='${escapeHtml(error2.toString())}'>${escapeHtml(latex)}</span>`;
25657
+ return `<span class="katex-error" title="${escapeHtml(latex)}">${escapeHtml(error2 + "")}</span>`;
25399
25658
  }
25400
25659
  };
25401
- var inlineRenderer = function(tokens, idx) {
25660
+ const inlineRenderer = (tokens, idx) => {
25402
25661
  return katexInline(tokens[idx].content);
25403
25662
  };
25404
- var katexBlock = function(latex) {
25405
- options.displayMode = true;
25663
+ const katexBlockRenderer = (latex) => {
25406
25664
  try {
25407
- return "<p class='katex-block'>" + katex.renderToString(latex, options) + "</p>";
25665
+ return `<p class="katex-block">${katex_1.default.renderToString(latex, { ...options, displayMode: true })}</p>`;
25408
25666
  } catch (error2) {
25409
- if (options.throwOnError) {
25667
+ if (options == null ? void 0 : options.throwOnError) {
25410
25668
  console.log(error2);
25411
25669
  }
25412
- return `<p class='katex-block katex-error' title='${escapeHtml(error2.toString())}'>${escapeHtml(latex)}</p>`;
25670
+ return `<p class="katex-block katex-error" title="${escapeHtml(latex)}">${escapeHtml(error2 + "")}</p>`;
25413
25671
  }
25414
25672
  };
25415
- var blockRenderer = function(tokens, idx) {
25416
- return katexBlock(tokens[idx].content) + "\n";
25673
+ const blockRenderer = (tokens, idx) => {
25674
+ return katexBlockRenderer(tokens[idx].content) + "\n";
25417
25675
  };
25418
- md.inline.ruler.after("escape", "math_inline", math_inline);
25419
- md.block.ruler.after("blockquote", "math_block", math_block, {
25420
- alt: ["paragraph", "reference", "blockquote", "list"]
25421
- });
25422
25676
  md.renderer.rules.math_inline = inlineRenderer;
25677
+ md.renderer.rules.math_inline_block = blockRenderer;
25678
+ md.renderer.rules.math_inline_bare_block = blockRenderer;
25423
25679
  md.renderer.rules.math_block = blockRenderer;
25424
- };
25425
- const katexPlugin = /* @__PURE__ */ getDefaultExportFromCjs(markdownItKatex);
25680
+ if (enableFencedBlocks) {
25681
+ const mathLanguageId = "math";
25682
+ const originalFenceRenderer = md.renderer.rules.fence;
25683
+ md.renderer.rules.fence = function(tokens, idx, options2, env, self2) {
25684
+ const token = tokens[idx];
25685
+ if (token.info.trim().toLowerCase() === mathLanguageId && enableFencedBlocks) {
25686
+ return katexBlockRenderer(token.content) + "\n";
25687
+ } else {
25688
+ return (originalFenceRenderer == null ? void 0 : originalFenceRenderer.call(this, tokens, idx, options2, env, self2)) || "";
25689
+ }
25690
+ };
25691
+ }
25692
+ }
25693
+ var _default = dist.default = default_1;
25426
25694
  function addDefaultVersions(paths, name2, version) {
25427
25695
  return paths.map((path) => {
25428
25696
  if (typeof path === "string" && !path.includes("://")) {
@@ -25506,9 +25774,9 @@ ${end2.comment}` : end2.comment;
25506
25774
  return loading;
25507
25775
  };
25508
25776
  const renderKatex = (source, displayMode) => {
25509
- const { katex: katex2 } = window;
25510
- if (katex2) {
25511
- return katex2.renderToString(source, {
25777
+ const { katex } = window;
25778
+ if (katex) {
25779
+ return katex.renderToString(source, {
25512
25780
  displayMode,
25513
25781
  throwOnError: false
25514
25782
  });
@@ -25520,7 +25788,7 @@ ${end2.comment}` : end2.comment;
25520
25788
  };
25521
25789
  let enableFeature = noop;
25522
25790
  transformHooks.parser.tap((md) => {
25523
- md.use(katexPlugin);
25791
+ md.use(_default);
25524
25792
  ["math_block", "math_inline"].forEach((key) => {
25525
25793
  const fn = (tokens, idx) => {
25526
25794
  enableFeature();
@@ -25686,7 +25954,7 @@ ${end2.comment}` : end2.comment;
25686
25954
  }
25687
25955
  }
25688
25956
  const transformerVersions = {
25689
- "markmap-lib": "0.17.3-alpha.1"
25957
+ "markmap-lib": "0.17.3-alpha.3"
25690
25958
  };
25691
25959
  exports.Transformer = Transformer;
25692
25960
  exports.builtInPlugins = builtInPlugins;
@@ -6,7 +6,7 @@ import md_mark from "markdown-it-mark";
6
6
  import md_sub from "markdown-it-sub";
7
7
  import md_sup from "markdown-it-sup";
8
8
  import { parse } from "yaml";
9
- import require$$0 from "katex";
9
+ import katexPlugin from "@vscode/markdown-it-katex";
10
10
  function initializeMarkdownIt() {
11
11
  const md = MarkdownIt({
12
12
  html: true,
@@ -189,162 +189,6 @@ const plugin$2 = definePlugin({
189
189
  };
190
190
  }
191
191
  });
192
- function getDefaultExportFromCjs(x) {
193
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
194
- }
195
- var katex = require$$0;
196
- function isValidDelim(state, pos) {
197
- var prevChar, nextChar, max = state.posMax, can_open = true, can_close = true;
198
- prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
199
- nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
200
- if (prevChar === 32 || prevChar === 9 || nextChar >= 48 && nextChar <= 57) {
201
- can_close = false;
202
- }
203
- if (nextChar === 32 || nextChar === 9) {
204
- can_open = false;
205
- }
206
- return {
207
- can_open,
208
- can_close
209
- };
210
- }
211
- function math_inline(state, silent) {
212
- var start, match, token, res, pos;
213
- if (state.src[state.pos] !== "$") {
214
- return false;
215
- }
216
- res = isValidDelim(state, state.pos);
217
- if (!res.can_open) {
218
- if (!silent) {
219
- state.pending += "$";
220
- }
221
- state.pos += 1;
222
- return true;
223
- }
224
- start = state.pos + 1;
225
- match = start;
226
- while ((match = state.src.indexOf("$", match)) !== -1) {
227
- pos = match - 1;
228
- while (state.src[pos] === "\\") {
229
- pos -= 1;
230
- }
231
- if ((match - pos) % 2 == 1) {
232
- break;
233
- }
234
- match += 1;
235
- }
236
- if (match === -1) {
237
- if (!silent) {
238
- state.pending += "$";
239
- }
240
- state.pos = start;
241
- return true;
242
- }
243
- if (match - start === 0) {
244
- if (!silent) {
245
- state.pending += "$$";
246
- }
247
- state.pos = start + 1;
248
- return true;
249
- }
250
- res = isValidDelim(state, match);
251
- if (!res.can_close) {
252
- if (!silent) {
253
- state.pending += "$";
254
- }
255
- state.pos = start;
256
- return true;
257
- }
258
- if (!silent) {
259
- token = state.push("math_inline", "math", 0);
260
- token.markup = "$";
261
- token.content = state.src.slice(start, match);
262
- }
263
- state.pos = match + 1;
264
- return true;
265
- }
266
- function math_block(state, start, end, silent) {
267
- var firstLine, lastLine, next, lastPos, found = false, token, pos = state.bMarks[start] + state.tShift[start], max = state.eMarks[start];
268
- if (pos + 2 > max) {
269
- return false;
270
- }
271
- if (state.src.slice(pos, pos + 2) !== "$$") {
272
- return false;
273
- }
274
- pos += 2;
275
- firstLine = state.src.slice(pos, max);
276
- if (silent) {
277
- return true;
278
- }
279
- if (firstLine.trim().slice(-2) === "$$") {
280
- firstLine = firstLine.trim().slice(0, -2);
281
- found = true;
282
- }
283
- for (next = start; !found; ) {
284
- next++;
285
- if (next >= end) {
286
- break;
287
- }
288
- pos = state.bMarks[next] + state.tShift[next];
289
- max = state.eMarks[next];
290
- if (pos < max && state.tShift[next] < state.blkIndent) {
291
- break;
292
- }
293
- if (state.src.slice(pos, max).trim().slice(-2) === "$$") {
294
- lastPos = state.src.slice(0, max).lastIndexOf("$$");
295
- lastLine = state.src.slice(pos, lastPos);
296
- found = true;
297
- }
298
- }
299
- state.line = next + 1;
300
- token = state.push("math_block", "math", 0);
301
- token.block = true;
302
- token.content = (firstLine && firstLine.trim() ? firstLine + "\n" : "") + state.getLines(start + 1, next, state.tShift[start], true) + (lastLine && lastLine.trim() ? lastLine : "");
303
- token.map = [start, state.line];
304
- token.markup = "$$";
305
- return true;
306
- }
307
- function escapeHtml(unsafe) {
308
- return unsafe.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
309
- }
310
- var markdownItKatex = function math_plugin(md, options) {
311
- options = options || {};
312
- var katexInline = function(latex) {
313
- options.displayMode = false;
314
- try {
315
- return katex.renderToString(latex, options);
316
- } catch (error) {
317
- if (options.throwOnError) {
318
- console.log(error);
319
- }
320
- return `<span class='katex-error' title='${escapeHtml(error.toString())}'>${escapeHtml(latex)}</span>`;
321
- }
322
- };
323
- var inlineRenderer = function(tokens, idx) {
324
- return katexInline(tokens[idx].content);
325
- };
326
- var katexBlock = function(latex) {
327
- options.displayMode = true;
328
- try {
329
- return "<p class='katex-block'>" + katex.renderToString(latex, options) + "</p>";
330
- } catch (error) {
331
- if (options.throwOnError) {
332
- console.log(error);
333
- }
334
- return `<p class='katex-block katex-error' title='${escapeHtml(error.toString())}'>${escapeHtml(latex)}</p>`;
335
- }
336
- };
337
- var blockRenderer = function(tokens, idx) {
338
- return katexBlock(tokens[idx].content) + "\n";
339
- };
340
- md.inline.ruler.after("escape", "math_inline", math_inline);
341
- md.block.ruler.after("blockquote", "math_block", math_block, {
342
- alt: ["paragraph", "reference", "blockquote", "list"]
343
- });
344
- md.renderer.rules.math_inline = inlineRenderer;
345
- md.renderer.rules.math_block = blockRenderer;
346
- };
347
- const katexPlugin = /* @__PURE__ */ getDefaultExportFromCjs(markdownItKatex);
348
192
  function addDefaultVersions(paths, name2, version) {
349
193
  return paths.map((path) => {
350
194
  if (typeof path === "string" && !path.includes("://")) {
@@ -428,9 +272,9 @@ const plugin$1 = definePlugin({
428
272
  return loading;
429
273
  };
430
274
  const renderKatex = (source, displayMode) => {
431
- const { katex: katex2 } = window;
432
- if (katex2) {
433
- return katex2.renderToString(source, {
275
+ const { katex } = window;
276
+ if (katex) {
277
+ return katex.renderToString(source, {
434
278
  displayMode,
435
279
  throwOnError: false
436
280
  });
@@ -608,7 +452,7 @@ class Transformer {
608
452
  }
609
453
  }
610
454
  const transformerVersions = {
611
- "markmap-lib": "0.17.3-alpha.1"
455
+ "markmap-lib": "0.17.3-alpha.3"
612
456
  };
613
457
  export {
614
458
  Transformer,
package/dist/index.js CHANGED
@@ -115,7 +115,7 @@ class Transformer {
115
115
  }
116
116
  }
117
117
  const transformerVersions = {
118
- "markmap-lib": "0.17.3-alpha.1"
118
+ "markmap-lib": "0.17.3-alpha.3"
119
119
  };
120
120
  exports.Transformer = Transformer;
121
121
  exports.builtInPlugins = builtInPlugins;
package/dist/index.mjs CHANGED
@@ -113,7 +113,7 @@ class Transformer {
113
113
  }
114
114
  }
115
115
  const transformerVersions = {
116
- "markmap-lib": "0.17.3-alpha.1"
116
+ "markmap-lib": "0.17.3-alpha.3"
117
117
  };
118
118
  export {
119
119
  Transformer,
@@ -123,7 +123,7 @@ class Transformer {
123
123
  }
124
124
  }
125
125
  const transformerVersions = {
126
- "markmap-lib": "0.17.3-alpha.1"
126
+ "markmap-lib": "0.17.3-alpha.3"
127
127
  };
128
128
  exports.Transformer = Transformer;
129
129
  exports.builtInPlugins = builtInPlugins;
@@ -121,7 +121,7 @@ class Transformer {
121
121
  }
122
122
  }
123
123
  const transformerVersions = {
124
- "markmap-lib": "0.17.3-alpha.1"
124
+ "markmap-lib": "0.17.3-alpha.3"
125
125
  };
126
126
  export {
127
127
  Transformer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markmap-lib",
3
- "version": "0.17.3-alpha.1+4942a37",
3
+ "version": "0.17.3-alpha.3+89ad076",
4
4
  "description": "Visualize your Markdown as mindmaps with Markmap",
5
5
  "author": "Gerald <gera2ld@live.com>",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "@highlightjs/cdn-assets": "^11.8.0",
62
62
  "@types/katex": "^0.16.7",
63
63
  "@types/markdown-it": "^14.0.0",
64
- "markmap-common": "0.17.1",
64
+ "markmap-common": "0.17.3-alpha.3+89ad076",
65
65
  "webfontloader": "^1.6.28"
66
66
  },
67
67
  "dependencies": {
@@ -74,8 +74,8 @@
74
74
  "markdown-it-mark": "^4.0.0",
75
75
  "markdown-it-sub": "^2.0.0",
76
76
  "markdown-it-sup": "^2.0.0",
77
- "markmap-html-parser": "0.17.3-alpha.1+4942a37",
78
- "markmap-view": "0.17.3-alpha.1+4942a37",
77
+ "markmap-html-parser": "0.17.3-alpha.3+89ad076",
78
+ "markmap-view": "0.17.3-alpha.3+89ad076",
79
79
  "prismjs": "^1.29.0",
80
80
  "yaml": "^2.5.1"
81
81
  },
@@ -96,5 +96,5 @@
96
96
  "^(.*\\.svg)\\?raw$": "$1"
97
97
  }
98
98
  },
99
- "gitHead": "4942a3759db08bbbc179034c0b08c5c2112566dc"
99
+ "gitHead": "89ad076e313dd4c126aeafc49f052315755e8c0d"
100
100
  }