marked 12.0.1 → 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.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * marked v12.0.1 - 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
  */
@@ -322,7 +322,9 @@ class _Tokenizer {
322
322
  blockquote(src) {
323
323
  const cap = this.rules.block.blockquote.exec(src);
324
324
  if (cap) {
325
- const text = rtrim(cap[0].replace(/^ *>[ \t]?/gm, ''), '\n');
325
+ // precede setext continuation with 4 spaces so it isn't a setext
326
+ let text = cap[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, '\n $1');
327
+ text = rtrim(text.replace(/^ *>[ \t]?/gm, ''), '\n');
326
328
  const top = this.lexer.state.top;
327
329
  this.lexer.state.top = true;
328
330
  const tokens = this.lexer.blockTokens(text);
@@ -958,7 +960,7 @@ const html = edit('^ {0,3}(?:' // optional indentation
958
960
  const paragraph = edit(_paragraph)
959
961
  .replace('hr', hr)
960
962
  .replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
961
- .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
963
+ .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
962
964
  .replace('|table', '')
963
965
  .replace('blockquote', ' {0,3}>')
964
966
  .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
@@ -1008,7 +1010,7 @@ const blockGfm = {
1008
1010
  paragraph: edit(_paragraph)
1009
1011
  .replace('hr', hr)
1010
1012
  .replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
1011
- .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
1013
+ .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
1012
1014
  .replace('table', gfmTable) // interrupt paragraphs with table
1013
1015
  .replace('blockquote', ' {0,3}>')
1014
1016
  .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')