Skip to content

fix: keep blank lines between paragraphs of a list item in a block quote#189

Open
divybot wants to merge 1 commit into
dprint:mainfrom
divybot:fix/blockquote-list-blank-lines
Open

fix: keep blank lines between paragraphs of a list item in a block quote#189
divybot wants to merge 1 commit into
dprint:mainfrom
divybot:fix/blockquote-list-blank-lines

Conversation

@divybot

@divybot divybot commented Jun 7, 2026

Copy link
Copy Markdown

Fixes the case where a blank line separating two paragraphs of a list item nested in a block quote was dropped, merging the two paragraphs into one.

Input

> 1. First paragraph.
>
>    Second paragraph.

Before

> 1. First paragraph.
>    Second paragraph.

After (matches input)

> 1. First paragraph.
>
>    Second paragraph.

Cause

A blank line inside a block quote is written as >, so the leading > character stopped has_leading_blankline from recognizing the line as blank while it scanned backwards. get_conditional_blank_line therefore only emitted a single newline between the two paragraphs of the list item.

Fix

When inside a block quote, skip the block quote markers (>) while scanning backwards for consecutive newlines. Outside of block quotes behaviour is unchanged.

Added spec tests under tests/specs/Issues/Deno/ (ordered + unordered lists, multiple paragraphs, nested block quote, textWrap: never, and a negative test ensuring soft-wrapped lines without a blank line still merge).

Reported downstream in Deno: denoland/deno#17758

A blank line inside a block quote is written as `>`, so the leading `>`
character prevented `has_leading_blankline` from recognizing the line as
blank. As a result the blank line between two paragraphs of a list item
nested in a block quote was dropped, merging the paragraphs.

Skip block quote markers while scanning backwards for blank lines when
inside a block quote.

Co-Authored-By: Divy Srivastava <me@littledivy.com>
littledivy added a commit to denoland/deno that referenced this pull request Jun 7, 2026
…ck quote

`deno fmt` dropped the blank line separating two paragraphs of a list item
nested in a block quote, merging them into a single paragraph (and previously
indenting the `>` marker). Markdown formatting is handled by the external
`dprint-plugin-markdown` crate, where `has_leading_blankline` failed to detect
a blank line inside a block quote because such a line is written as `>` and the
leading `>` character broke its backwards scan.

The fix lives in dprint-plugin-markdown
(dprint/dprint-plugin-markdown#189). Until a release
containing it is published, consume it via a temporary `[patch.crates-io]`
pointing at a branch with the fix backported onto the 0.20.0 release.

Adds a spec test verifying the blank line is preserved.

Closes #17758

Co-Authored-By: Divy Srivastava <me@littledivy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants