Skip to content

Fix Markdown blockquote parsing#1627

Open
st0012 wants to merge 1 commit intomasterfrom
fix-blockquote-lazy-continuation
Open

Fix Markdown blockquote parsing#1627
st0012 wants to merge 1 commit intomasterfrom
fix-blockquote-lazy-continuation

Conversation

@st0012
Copy link
Member

@st0012 st0012 commented Feb 28, 2026

Summary

Two fixes to the BlockQuoteRaw rule in the PEG grammar:

  • Separate blockquotes (separated by an unquoted blank line) were merged into one. Now only blank lines prefixed with > continue the blockquote, so an unquoted blank line ends it.
  • Lazy continuation was consuming block-level elements (headings, list markers, code fences) that should break out of the blockquote. Added negative lookaheads for these elements.

Ref: #1550 (comment)

@matzbot
Copy link
Collaborator

matzbot commented Feb 28, 2026

🚀 Preview deployment available at: https://82707249.rdoc-6cd.pages.dev (commit: 0706cd1)

@st0012 st0012 force-pushed the fix-blockquote-lazy-continuation branch from 1959fd1 to d658309 Compare February 28, 2026 21:23
@st0012 st0012 added the bug label Feb 28, 2026
@st0012 st0012 force-pushed the fix-blockquote-lazy-continuation branch 4 times, most recently from 6f54b65 to c168d42 Compare February 28, 2026 22:33
@st0012 st0012 changed the title Fix blockquote lazy continuation and preserve Markdown newlines Fix blockquote parsing and soft line break rendering to match GFM Feb 28, 2026
@st0012 st0012 changed the title Fix blockquote parsing and soft line break rendering to match GFM Improve Markdown blockquote rendering Feb 28, 2026
@st0012 st0012 force-pushed the fix-blockquote-lazy-continuation branch from c168d42 to 3d620eb Compare February 28, 2026 23:30
Two changes to the BlockQuoteRaw rule in the PEG grammar:

1. Stop lazy continuation from consuming block-level elements by adding
   negative lookaheads for headings, list markers, and code fences.

2. End blockquotes at unquoted blank lines. Previously, all blank lines
   were consumed and the parser continued matching subsequent > lines as
   part of the same blockquote. Now only blank lines prefixed with >
   continue the blockquote, matching GFM where an unquoted blank line
   separates two distinct blockquotes.
@st0012 st0012 force-pushed the fix-blockquote-lazy-continuation branch from 3d620eb to 0706cd1 Compare March 1, 2026 12:14
@st0012 st0012 changed the title Improve Markdown blockquote rendering Fix Markdown blockquote parsing Mar 1, 2026
@st0012 st0012 marked this pull request as ready for review March 1, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants