ANSI writer: fix missing bar on blockquote's first line (#11877)

D.prefixed only emits its prefix on a line that starts at column 0.
When a BlockQuote is the first block of a list item, the item's
marker and the quote's content are joined onto the same line, so
the quote's Prefixed doc begins mid-line and its "| " bar is
dropped on that first line, while later wrapped lines (which do
start at column 0) render it correctly.

Force the blockquote onto its own line with D.cr before applying
the prefix. D.cr is a no-op when already at the start of a line,
so top-level and nested blockquotes are unaffected.

Fixes #11804
This commit is contained in:
Gaurav Vijay Jadhav
2026-09-18 10:42:27 -07:00
committed by GitHub
parent 85d8784a17
commit b07038cd12
3 changed files with 19 additions and 1 deletions
+6 -1
View File
@@ -190,7 +190,12 @@ blockToANSI opts (CodeBlock attr str) = do
blockToANSI opts (BlockQuote blocks) = do
contents <- withFewerColumns 2 $ blockListToANSI opts blocks
return ( D.prefixed "" contents $$ D.blankline)
-- D.cr ensures we start the blockquote on its own line: without it,
-- a blockquote that begins mid-line (e.g. as the first block of a
-- list item, sharing a line with the item's marker) would have its
-- prefix omitted on the first line, since D.prefixed only prefixes
-- lines that begin at column 0.
return ( D.cr <> D.prefixed "" contents $$ D.blankline)
blockToANSI opts (Table _ (Caption _ caption) colSpecs (TableHead _ thead) tbody (TableFoot _ tfoot)) = do
let captionInlines = blocksToInlines caption
+7
View File
@@ -34,6 +34,13 @@ Text
│ │ Nested block quote
Numbered list item beginning with a block quote (regression test for
issue #11804, where the leading bar was dropped on the block quotes
first line because it shared a line with the list marker):
1.
│ List item block quote
Multiline table with caption:
Centered Left Right Default aligned
+6
View File
@@ -38,6 +38,12 @@ Text
>
> > Nested block quote
Numbered list item beginning with a block quote (regression test for
issue #11804, where the leading bar was dropped on the block quote's
first line because it shared a line with the list marker):
1. > List item block quote
Multiline table with caption:
: Here's the caption.