markmap-lib 0.17.3-alpha.2 → 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);
@@ -15057,9 +15058,9 @@
15057
15058
  return -1;
15058
15059
  };
15059
15060
  Ruler.prototype.__compile__ = function() {
15060
- const self = this;
15061
+ const self2 = this;
15061
15062
  const chains = [""];
15062
- self.__rules__.forEach(function(rule) {
15063
+ self2.__rules__.forEach(function(rule) {
15063
15064
  if (!rule.enabled) {
15064
15065
  return;
15065
15066
  }
@@ -15069,17 +15070,17 @@
15069
15070
  }
15070
15071
  });
15071
15072
  });
15072
- self.__cache__ = {};
15073
+ self2.__cache__ = {};
15073
15074
  chains.forEach(function(chain) {
15074
- self.__cache__[chain] = [];
15075
- self.__rules__.forEach(function(rule) {
15075
+ self2.__cache__[chain] = [];
15076
+ self2.__rules__.forEach(function(rule) {
15076
15077
  if (!rule.enabled) {
15077
15078
  return;
15078
15079
  }
15079
15080
  if (chain && rule.alt.indexOf(chain) < 0) {
15080
15081
  return;
15081
15082
  }
15082
- self.__cache__[chain].push(rule.fn);
15083
+ self2.__cache__[chain].push(rule.fn);
15083
15084
  });
15084
15085
  });
15085
15086
  };
@@ -18024,16 +18025,16 @@
18024
18025
  }
18025
18026
  const defaultSchemas = {
18026
18027
  "http:": {
18027
- validate: function(text2, pos, self) {
18028
+ validate: function(text2, pos, self2) {
18028
18029
  const tail = text2.slice(pos);
18029
- if (!self.re.http) {
18030
- self.re.http = new RegExp(
18031
- "^\\/\\/" + 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,
18032
18033
  "i"
18033
18034
  );
18034
18035
  }
18035
- if (self.re.http.test(tail)) {
18036
- return tail.match(self.re.http)[0].length;
18036
+ if (self2.re.http.test(tail)) {
18037
+ return tail.match(self2.re.http)[0].length;
18037
18038
  }
18038
18039
  return 0;
18039
18040
  }
@@ -18041,39 +18042,39 @@
18041
18042
  "https:": "http:",
18042
18043
  "ftp:": "http:",
18043
18044
  "//": {
18044
- validate: function(text2, pos, self) {
18045
+ validate: function(text2, pos, self2) {
18045
18046
  const tail = text2.slice(pos);
18046
- if (!self.re.no_http) {
18047
- self.re.no_http = new RegExp(
18048
- "^" + 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'
18049
18050
  // with code comments
18050
- "(?: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,
18051
18052
  "i"
18052
18053
  );
18053
18054
  }
18054
- if (self.re.no_http.test(tail)) {
18055
+ if (self2.re.no_http.test(tail)) {
18055
18056
  if (pos >= 3 && text2[pos - 3] === ":") {
18056
18057
  return 0;
18057
18058
  }
18058
18059
  if (pos >= 3 && text2[pos - 3] === "/") {
18059
18060
  return 0;
18060
18061
  }
18061
- return tail.match(self.re.no_http)[0].length;
18062
+ return tail.match(self2.re.no_http)[0].length;
18062
18063
  }
18063
18064
  return 0;
18064
18065
  }
18065
18066
  },
18066
18067
  "mailto:": {
18067
- validate: function(text2, pos, self) {
18068
+ validate: function(text2, pos, self2) {
18068
18069
  const tail = text2.slice(pos);
18069
- if (!self.re.mailto) {
18070
- self.re.mailto = new RegExp(
18071
- "^" + 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,
18072
18073
  "i"
18073
18074
  );
18074
18075
  }
18075
- if (self.re.mailto.test(tail)) {
18076
- return tail.match(self.re.mailto)[0].length;
18076
+ if (self2.re.mailto.test(tail)) {
18077
+ return tail.match(self2.re.mailto)[0].length;
18077
18078
  }
18078
18079
  return 0;
18079
18080
  }
@@ -18081,9 +18082,9 @@
18081
18082
  };
18082
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]";
18083
18084
  const tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");
18084
- function resetScanCache(self) {
18085
- self.__index__ = -1;
18086
- self.__text_cache__ = "";
18085
+ function resetScanCache(self2) {
18086
+ self2.__index__ = -1;
18087
+ self2.__text_cache__ = "";
18087
18088
  }
18088
18089
  function createValidator(re) {
18089
18090
  return function(text2, pos) {
@@ -18095,15 +18096,15 @@
18095
18096
  };
18096
18097
  }
18097
18098
  function createNormalizer() {
18098
- return function(match, self) {
18099
- self.normalize(match);
18099
+ return function(match, self2) {
18100
+ self2.normalize(match);
18100
18101
  };
18101
18102
  }
18102
- function compile(self) {
18103
- const re = self.re = reFactory(self.__opts__);
18104
- const tlds = self.__tlds__.slice();
18105
- self.onCompile();
18106
- 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__) {
18107
18108
  tlds.push(tlds_2ch_src_re);
18108
18109
  }
18109
18110
  tlds.push(re.src_xn);
@@ -18116,17 +18117,17 @@
18116
18117
  re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i");
18117
18118
  re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i");
18118
18119
  const aliases2 = [];
18119
- self.__compiled__ = {};
18120
+ self2.__compiled__ = {};
18120
18121
  function schemaError(name2, val2) {
18121
18122
  throw new Error('(LinkifyIt) Invalid schema "' + name2 + '": ' + val2);
18122
18123
  }
18123
- Object.keys(self.__schemas__).forEach(function(name2) {
18124
- const val2 = self.__schemas__[name2];
18124
+ Object.keys(self2.__schemas__).forEach(function(name2) {
18125
+ const val2 = self2.__schemas__[name2];
18125
18126
  if (val2 === null) {
18126
18127
  return;
18127
18128
  }
18128
18129
  const compiled = { validate: null, link: null };
18129
- self.__compiled__[name2] = compiled;
18130
+ self2.__compiled__[name2] = compiled;
18130
18131
  if (isObject(val2)) {
18131
18132
  if (isRegExp(val2.validate)) {
18132
18133
  compiled.validate = createValidator(val2.validate);
@@ -18151,39 +18152,39 @@
18151
18152
  schemaError(name2, val2);
18152
18153
  });
18153
18154
  aliases2.forEach(function(alias) {
18154
- if (!self.__compiled__[self.__schemas__[alias]]) {
18155
+ if (!self2.__compiled__[self2.__schemas__[alias]]) {
18155
18156
  return;
18156
18157
  }
18157
- self.__compiled__[alias].validate = self.__compiled__[self.__schemas__[alias]].validate;
18158
- 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;
18159
18160
  });
18160
- self.__compiled__[""] = { validate: null, normalize: createNormalizer() };
18161
- const slist = Object.keys(self.__compiled__).filter(function(name2) {
18162
- 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];
18163
18164
  }).map(escapeRE).join("|");
18164
- self.re.schema_test = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "i");
18165
- self.re.schema_search = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "ig");
18166
- self.re.schema_at_start = RegExp("^" + self.re.schema_search.source, "i");
18167
- self.re.pretest = RegExp(
18168
- "(" + 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 + ")|@",
18169
18170
  "i"
18170
18171
  );
18171
- resetScanCache(self);
18172
+ resetScanCache(self2);
18172
18173
  }
18173
- function Match(self, shift) {
18174
- const start = self.__index__;
18175
- const end2 = self.__last_index__;
18176
- const text2 = self.__text_cache__.slice(start, end2);
18177
- 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();
18178
18179
  this.index = start + shift;
18179
18180
  this.lastIndex = end2 + shift;
18180
18181
  this.raw = text2;
18181
18182
  this.text = text2;
18182
18183
  this.url = text2;
18183
18184
  }
18184
- function createMatch(self, shift) {
18185
- const match = new Match(self, shift);
18186
- 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);
18187
18188
  return match;
18188
18189
  }
18189
18190
  function LinkifyIt(schemas2, options) {
@@ -18798,7 +18799,7 @@
18798
18799
  return this;
18799
18800
  };
18800
18801
  MarkdownIt.prototype.configure = function(presets) {
18801
- const self = this;
18802
+ const self2 = this;
18802
18803
  if (isString$1(presets)) {
18803
18804
  const presetName = presets;
18804
18805
  presets = config$2[presetName];
@@ -18810,15 +18811,15 @@
18810
18811
  throw new Error("Wrong `markdown-it` preset, can't be empty");
18811
18812
  }
18812
18813
  if (presets.options) {
18813
- self.set(presets.options);
18814
+ self2.set(presets.options);
18814
18815
  }
18815
18816
  if (presets.components) {
18816
18817
  Object.keys(presets.components).forEach(function(name2) {
18817
18818
  if (presets.components[name2].rules) {
18818
- self[name2].ruler.enableOnly(presets.components[name2].rules);
18819
+ self2[name2].ruler.enableOnly(presets.components[name2].rules);
18819
18820
  }
18820
18821
  if (presets.components[name2].rules2) {
18821
- self[name2].ruler2.enableOnly(presets.components[name2].rules2);
18822
+ self2[name2].ruler2.enableOnly(presets.components[name2].rules2);
18822
18823
  }
18823
18824
  });
18824
18825
  }
@@ -25280,28 +25281,56 @@ ${end2.comment}` : end2.comment;
25280
25281
  };
25281
25282
  }
25282
25283
  });
25283
- var katex = require$$0;
25284
- function isValidDelim(state, pos) {
25285
- var prevChar, nextChar, max = state.posMax, can_open = true, can_close = true;
25286
- prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
25287
- nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
25288
- if (prevChar === 32 || prevChar === 9 || nextChar >= 48 && nextChar <= 57) {
25289
- can_close = false;
25290
- }
25291
- if (nextChar === 32 || nextChar === 9) {
25292
- can_open = false;
25293
- }
25294
- return {
25295
- can_open,
25296
- can_close
25297
- };
25298
- }
25299
- function math_inline(state, silent) {
25300
- 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) {
25301
25324
  if (state.src[state.pos] !== "$") {
25302
25325
  return false;
25303
25326
  }
25304
- 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);
25305
25334
  if (!res.can_open) {
25306
25335
  if (!silent) {
25307
25336
  state.pending += "$";
@@ -25309,8 +25338,9 @@ ${end2.comment}` : end2.comment;
25309
25338
  state.pos += 1;
25310
25339
  return true;
25311
25340
  }
25312
- start = state.pos + 1;
25313
- match = start;
25341
+ let start = state.pos + 1;
25342
+ let match = start;
25343
+ let pos;
25314
25344
  while ((match = state.src.indexOf("$", match)) !== -1) {
25315
25345
  pos = match - 1;
25316
25346
  while (state.src[pos] === "\\") {
@@ -25335,7 +25365,7 @@ ${end2.comment}` : end2.comment;
25335
25365
  state.pos = start + 1;
25336
25366
  return true;
25337
25367
  }
25338
- res = isValidDelim(state, match);
25368
+ res = isValidInlineDelim(state, match);
25339
25369
  if (!res.can_close) {
25340
25370
  if (!silent) {
25341
25371
  state.pending += "$";
@@ -25344,15 +25374,15 @@ ${end2.comment}` : end2.comment;
25344
25374
  return true;
25345
25375
  }
25346
25376
  if (!silent) {
25347
- token = state.push("math_inline", "math", 0);
25377
+ const token = state.push("math_inline", "math", 0);
25348
25378
  token.markup = "$";
25349
25379
  token.content = state.src.slice(start, match);
25350
25380
  }
25351
25381
  state.pos = match + 1;
25352
25382
  return true;
25353
25383
  }
25354
- function math_block(state, start, end2, silent) {
25355
- 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];
25356
25386
  if (pos + 2 > max) {
25357
25387
  return false;
25358
25388
  }
@@ -25360,7 +25390,7 @@ ${end2.comment}` : end2.comment;
25360
25390
  return false;
25361
25391
  }
25362
25392
  pos += 2;
25363
- firstLine = state.src.slice(pos, max);
25393
+ let firstLine = state.src.slice(pos, max);
25364
25394
  if (silent) {
25365
25395
  return true;
25366
25396
  }
@@ -25382,6 +25412,10 @@ ${end2.comment}` : end2.comment;
25382
25412
  lastPos = state.src.slice(0, max).lastIndexOf("$$");
25383
25413
  lastLine = state.src.slice(pos, lastPos);
25384
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;
25385
25419
  }
25386
25420
  }
25387
25421
  state.line = next2 + 1;
@@ -25392,47 +25426,271 @@ ${end2.comment}` : end2.comment;
25392
25426
  token.markup = "$$";
25393
25427
  return true;
25394
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
+ }
25395
25616
  function escapeHtml(unsafe) {
25396
25617
  return unsafe.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
25397
25618
  }
25398
- var markdownItKatex = function math_plugin(md, options) {
25399
- options = options || {};
25400
- var katexInline = function(latex) {
25401
- 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);
25402
25651
  try {
25403
- return katex.renderToString(latex, options);
25652
+ return katex_1.default.renderToString(latex, { ...options, displayMode });
25404
25653
  } catch (error2) {
25405
- if (options.throwOnError) {
25654
+ if (options == null ? void 0 : options.throwOnError) {
25406
25655
  console.log(error2);
25407
25656
  }
25408
- return `<span class='katex-error' title='${escapeHtml(error2.toString())}'>${escapeHtml(latex)}</span>`;
25657
+ return `<span class="katex-error" title="${escapeHtml(latex)}">${escapeHtml(error2 + "")}</span>`;
25409
25658
  }
25410
25659
  };
25411
- var inlineRenderer = function(tokens, idx) {
25660
+ const inlineRenderer = (tokens, idx) => {
25412
25661
  return katexInline(tokens[idx].content);
25413
25662
  };
25414
- var katexBlock = function(latex) {
25415
- options.displayMode = true;
25663
+ const katexBlockRenderer = (latex) => {
25416
25664
  try {
25417
- 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>`;
25418
25666
  } catch (error2) {
25419
- if (options.throwOnError) {
25667
+ if (options == null ? void 0 : options.throwOnError) {
25420
25668
  console.log(error2);
25421
25669
  }
25422
- 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>`;
25423
25671
  }
25424
25672
  };
25425
- var blockRenderer = function(tokens, idx) {
25426
- return katexBlock(tokens[idx].content) + "\n";
25673
+ const blockRenderer = (tokens, idx) => {
25674
+ return katexBlockRenderer(tokens[idx].content) + "\n";
25427
25675
  };
25428
- md.inline.ruler.after("escape", "math_inline", math_inline);
25429
- md.block.ruler.after("blockquote", "math_block", math_block, {
25430
- alt: ["paragraph", "reference", "blockquote", "list"]
25431
- });
25432
25676
  md.renderer.rules.math_inline = inlineRenderer;
25677
+ md.renderer.rules.math_inline_block = blockRenderer;
25678
+ md.renderer.rules.math_inline_bare_block = blockRenderer;
25433
25679
  md.renderer.rules.math_block = blockRenderer;
25434
- };
25435
- 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;
25436
25694
  function addDefaultVersions(paths, name2, version) {
25437
25695
  return paths.map((path) => {
25438
25696
  if (typeof path === "string" && !path.includes("://")) {
@@ -25516,9 +25774,9 @@ ${end2.comment}` : end2.comment;
25516
25774
  return loading;
25517
25775
  };
25518
25776
  const renderKatex = (source, displayMode) => {
25519
- const { katex: katex2 } = window;
25520
- if (katex2) {
25521
- return katex2.renderToString(source, {
25777
+ const { katex } = window;
25778
+ if (katex) {
25779
+ return katex.renderToString(source, {
25522
25780
  displayMode,
25523
25781
  throwOnError: false
25524
25782
  });
@@ -25530,7 +25788,7 @@ ${end2.comment}` : end2.comment;
25530
25788
  };
25531
25789
  let enableFeature = noop;
25532
25790
  transformHooks.parser.tap((md) => {
25533
- md.use(katexPlugin);
25791
+ md.use(_default);
25534
25792
  ["math_block", "math_inline"].forEach((key) => {
25535
25793
  const fn = (tokens, idx) => {
25536
25794
  enableFeature();
@@ -25696,7 +25954,7 @@ ${end2.comment}` : end2.comment;
25696
25954
  }
25697
25955
  }
25698
25956
  const transformerVersions = {
25699
- "markmap-lib": "0.17.3-alpha.2"
25957
+ "markmap-lib": "0.17.3-alpha.3"
25700
25958
  };
25701
25959
  exports.Transformer = Transformer;
25702
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.2"
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.2"
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.2"
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.2"
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.2"
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.2+9f2920f",
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.2+9f2920f",
78
- "markmap-view": "0.17.2",
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": "9f2920fcb10e39ca7bf714c8768539bf60357752"
99
+ "gitHead": "89ad076e313dd4c126aeafc49f052315755e8c0d"
100
100
  }