marked 9.1.4 → 9.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/marked.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * marked v9.1.4 - a markdown parser
2
+ * marked v9.1.6 - a markdown parser
3
3
  * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -755,7 +755,7 @@
755
755
  const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
756
756
  endReg.lastIndex = 0;
757
757
  // Clip maskedSrc to same section of string as src (move to lexer?)
758
- maskedSrc = maskedSrc.slice(-1 * src.length + match[0].length - 1);
758
+ maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
759
759
  while ((match = endReg.exec(maskedSrc)) != null) {
760
760
  rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
761
761
  if (!rDelim)
@@ -776,7 +776,9 @@
776
776
  continue; // Haven't found enough closing delimiters
777
777
  // Remove extra characters. *a*** -> *a*
778
778
  rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
779
- const raw = [...src].slice(0, lLength + match.index + rLength + 1).join('');
779
+ // char length can be >1 for unicode characters;
780
+ const lastCharLength = [...match[0]][0].length;
781
+ const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
780
782
  // Create `em` if smallest delimiter has odd char count. *a***
781
783
  if (Math.min(lLength, rLength) % 2) {
782
784
  const text = raw.slice(1, -1);
@@ -2054,11 +2056,9 @@
2054
2056
  parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);
2055
2057
  parseInline = this.#parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
2056
2058
  Parser = _Parser;
2057
- parser = _Parser.parse;
2058
2059
  Renderer = _Renderer;
2059
2060
  TextRenderer = _TextRenderer;
2060
2061
  Lexer = _Lexer;
2061
- lexer = _Lexer.lex;
2062
2062
  Tokenizer = _Tokenizer;
2063
2063
  Hooks = _Hooks;
2064
2064
  constructor(...args) {
@@ -2255,6 +2255,12 @@
2255
2255
  this.defaults = { ...this.defaults, ...opt };
2256
2256
  return this;
2257
2257
  }
2258
+ lexer(src, options) {
2259
+ return _Lexer.lex(src, options ?? this.defaults);
2260
+ }
2261
+ parser(tokens, options) {
2262
+ return _Parser.parse(tokens, options ?? this.defaults);
2263
+ }
2258
2264
  #parseMarkdown(lexer, parser) {
2259
2265
  return (src, options) => {
2260
2266
  const origOpt = { ...options };