Skip to content

fix(markdown): accept blank line after admonition header#3102

Open
leno23 wants to merge 2 commits into
rust-lang:masterfrom
leno23:fix/admonition-blank-line-3066
Open

fix(markdown): accept blank line after admonition header#3102
leno23 wants to merge 2 commits into
rust-lang:masterfrom
leno23:fix/admonition-blank-line-3066

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Supports GFM admonitions with a blank > line after the header:

> [!NOTE]
>
> Content here

pulldown-cmark splits this into two blockquotes (see pulldown-cmark#890); this merges those events so mdBook renders a proper admonition. The syntax matches GitHub and survives Markdown prettifiers that insert a blank line after headings.

Implementation adapted from the iterator adapter proposed in #3066.

new_cmark_parser now returns an opaque MarkdownParser struct (still implements Iterator<Item = Event>) instead of pulldown_cmark::Parser directly.

Fixes #3066.

Test plan

  • Added prettifier-safe admonition case to markdown/admonitions
  • cargo test -p mdbook --test testsuite (110 passed)

Made with Cursor

Merge pulldown-cmark blockquote events split when an admonition header
is followed by a blank `>` line, matching GitHub GFM and surviving
Markdown prettifiers (pulldown-cmark rust-lang#890).

Fixes rust-lang#3066.

Co-authored-by: Cursor <cursoragent@cursor.com>
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label May 17, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More compatible admonition parsing

2 participants