From 3bf083296c33aac692c83bb1b8b78eee079c08c4 Mon Sep 17 00:00:00 2001 From: Mradul Singh Date: Tue, 17 Nov 2026 13:34:41 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20Don't=20read=20a=20`>`=20?= =?UTF-8?q?indented=20by=204+=20spaces=20as=20a=20block=20quote=20marker?= =?UTF-8?q?=20on=20continuation=20lines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A block quote marker may be indented by at most 3 spaces. The first line already checks this with is_code_block, but the loop over the following lines did not, so `> a\n > b` dropped the second `>` instead of keeping it as lazy paragraph continuation text (as commonmark.js does). Fixes #473 --- markdown_it/rules_block/blockquote.py | 8 +++- tests/test_port/fixtures/issue-fixes.md | 50 +++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/markdown_it/rules_block/blockquote.py b/markdown_it/rules_block/blockquote.py index de2d4f2d..e00b510f 100644 --- a/markdown_it/rules_block/blockquote.py +++ b/markdown_it/rules_block/blockquote.py @@ -147,7 +147,13 @@ def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool) -> # Case 1: line is not inside the blockquote, and this line is empty. break - evaluatesTrue = state.src[pos] == ">" and not isOutdented + # A `>` indented by 4+ spaces is not a block quote marker + # (it is lazy paragraph continuation text instead). + evaluatesTrue = ( + state.src[pos] == ">" + and not isOutdented + and not state.is_code_block(nextLine) + ) pos += 1 if evaluatesTrue: # This line is inside the blockquote. diff --git a/tests/test_port/fixtures/issue-fixes.md b/tests/test_port/fixtures/issue-fixes.md index fefef099..369be9bc 100644 --- a/tests/test_port/fixtures/issue-fixes.md +++ b/tests/test_port/fixtures/issue-fixes.md @@ -244,3 +244,53 @@ para *a* . + +#473 a `>` indented by 4+ spaces on a continuation line is not a block quote marker +. +> a + > b +. +
+

a +> b

+
+. + +#473 same inside a list item +. +- > a + > b +. + +. + +#473 same inside a nested block quote +. +> > a +> > b +. +
+
+

a +> b

+
+
+. + +#473 a `>` indented by 3 spaces still continues the block quote +. +> a + > b +. +
+

a +b

+
+.