marked 15.0.7 → 15.0.9

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.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * marked v15.0.7 - a markdown parser
2
+ * marked v15.0.9 - a markdown parser
3
3
  * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -543,6 +543,9 @@ function findClosingBracket(str, b) {
543
543
  }
544
544
  }
545
545
  }
546
+ if (level > 0) {
547
+ return -2;
548
+ }
546
549
  return -1;
547
550
  }
548
551
 
@@ -1109,6 +1112,10 @@ class _Tokenizer {
1109
1112
  else {
1110
1113
  // find closing parenthesis
1111
1114
  const lastParenIndex = findClosingBracket(cap[2], '()');
1115
+ if (lastParenIndex === -2) {
1116
+ // more open parens than closed
1117
+ return;
1118
+ }
1112
1119
  if (lastParenIndex > -1) {
1113
1120
  const start = cap[0].indexOf('!') === 0 ? 5 : 4;
1114
1121
  const linkLen = start + cap[1].length + lastParenIndex;
@@ -1613,14 +1620,14 @@ class _Lexer {
1613
1620
  }
1614
1621
  }
1615
1622
  }
1616
- // Mask out other blocks
1617
- while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1618
- maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1619
- }
1620
1623
  // Mask out escaped characters
1621
1624
  while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
1622
1625
  maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1623
1626
  }
1627
+ // Mask out other blocks
1628
+ while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1629
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1630
+ }
1624
1631
  let keepPrevChar = false;
1625
1632
  let prevChar = '';
1626
1633
  while (src) {