From e2f77b4b72ccaefeb99fc74df2bfd7016636c3b2 Mon Sep 17 00:00:00 2001 From: Wei-Lun Li Date: Tue, 17 Nov 2026 01:20:44 +0900 Subject: [PATCH] fix: end a block quote at a lazy line after an empty list item (#4178) Co-authored-by: Claude Opus 5.5 --- src/Tokenizer.ts | 6 ++++ .../blockquote_empty_list_item_lazy_line.html | 29 +++++++++++++++++++ .../blockquote_empty_list_item_lazy_line.md | 12 ++++++++ 3 files changed, 47 insertions(+) create mode 100644 test/specs/new/blockquote_empty_list_item_lazy_line.html create mode 100644 test/specs/new/blockquote_empty_list_item_lazy_line.md diff --git a/src/Tokenizer.ts b/src/Tokenizer.ts index 39ea1149..7f7b2c24 100644 --- a/src/Tokenizer.ts +++ b/src/Tokenizer.ts @@ -338,6 +338,12 @@ export class _Tokenizer { text = `${text}\n${consumed}`; } lines = lines.slice(consumedCount); + + // A lazy line the list did not take is not a paragraph continuation, + // e.g. after an empty list item, so it ends the blockquote. + if (lines.length > 0 && !this.rules.other.blockquoteStart.test(lines[0])) { + break; + } continue; } } diff --git a/test/specs/new/blockquote_empty_list_item_lazy_line.html b/test/specs/new/blockquote_empty_list_item_lazy_line.html new file mode 100644 index 00000000..7289c4d7 --- /dev/null +++ b/test/specs/new/blockquote_empty_list_item_lazy_line.html @@ -0,0 +1,29 @@ +
+
    +
  • +
+
+

foo

+
+
    +
  1. +
+
+

bar

+
+
+
    +
  • +
+
+
+

baz

+
+
    +
  • +
+
+

qux

+
+

quux

+
diff --git a/test/specs/new/blockquote_empty_list_item_lazy_line.md b/test/specs/new/blockquote_empty_list_item_lazy_line.md new file mode 100644 index 00000000..9ca22735 --- /dev/null +++ b/test/specs/new/blockquote_empty_list_item_lazy_line.md @@ -0,0 +1,12 @@ +> - +foo + +> 1. +bar + +> > * +baz + +> - +qux +> quux