marked 12.0.0 → 12.0.2

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 v12.0.0 - a markdown parser
2
+ * marked v12.0.2 - a markdown parser
3
3
  * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -328,7 +328,9 @@
328
328
  blockquote(src) {
329
329
  const cap = this.rules.block.blockquote.exec(src);
330
330
  if (cap) {
331
- const text = rtrim(cap[0].replace(/^ *>[ \t]?/gm, ''), '\n');
331
+ // precede setext continuation with 4 spaces so it isn't a setext
332
+ let text = cap[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, '\n $1');
333
+ text = rtrim(text.replace(/^ *>[ \t]?/gm, ''), '\n');
332
334
  const top = this.lexer.state.top;
333
335
  this.lexer.state.top = true;
334
336
  const tokens = this.lexer.blockTokens(text);
@@ -922,8 +924,13 @@
922
924
  const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
923
925
  const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
924
926
  const bullet = /(?:[*+-]|\d{1,9}[.)])/;
925
- const lheading = edit(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
927
+ const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
926
928
  .replace(/bull/g, bullet) // lists can interrupt
929
+ .replace(/blockCode/g, / {4}/) // indented code blocks can interrupt
930
+ .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
931
+ .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
932
+ .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
933
+ .replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
927
934
  .getRegex();
928
935
  const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
929
936
  const blockText = /^[^\n]+/;
@@ -959,7 +966,7 @@
959
966
  const paragraph = edit(_paragraph)
960
967
  .replace('hr', hr)
961
968
  .replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
962
- .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
969
+ .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
963
970
  .replace('|table', '')
964
971
  .replace('blockquote', ' {0,3}>')
965
972
  .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
@@ -1009,7 +1016,7 @@
1009
1016
  paragraph: edit(_paragraph)
1010
1017
  .replace('hr', hr)
1011
1018
  .replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
1012
- .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
1019
+ .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
1013
1020
  .replace('table', gfmTable) // interrupt paragraphs with table
1014
1021
  .replace('blockquote', ' {0,3}>')
1015
1022
  .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')