diff --git a/src/Text/Pandoc/Writers/ANSI.hs b/src/Text/Pandoc/Writers/ANSI.hs index e20713f61..ddcc30c46 100644 --- a/src/Text/Pandoc/Writers/ANSI.hs +++ b/src/Text/Pandoc/Writers/ANSI.hs @@ -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 diff --git a/test/ansi-test.ansi b/test/ansi-test.ansi index 57147eacc..ae4f9398a 100644 --- a/test/ansi-test.ansi +++ b/test/ansi-test.ansi @@ -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 quote’s +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 diff --git a/test/ansi-test.txt b/test/ansi-test.txt index 4e6f9800c..692b445b3 100644 --- a/test/ansi-test.txt +++ b/test/ansi-test.txt @@ -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.