Skip to content

Fix code block whitespace handling in Markdown#155040

Open
yalagadapavankumar wants to merge 2 commits intorust-lang:mainfrom
yalagadapavankumar:fix-whitespace
Open

Fix code block whitespace handling in Markdown#155040
yalagadapavankumar wants to merge 2 commits intorust-lang:mainfrom
yalagadapavankumar:fix-whitespace

Conversation

@yalagadapavankumar
Copy link
Copy Markdown

@yalagadapavankumar yalagadapavankumar commented Apr 9, 2026

Fix Markdown code block closing whitespace handling

Previously, the parser incorrectly accepted closing backticks followed by extra text and rejected lines where only spaces appeared after closing backticks. This did not match expected Markdown behavior.

Now, the parser correctly ends a code block only when line after the code ends with spaces or nothing. Lines where extra text appears after the closing backticks are treated as part of the code block.

Includes tests for both correct and incorrect cases.

Related issue

This PR addresses the Outreachy issue: Markdown whitespace bug in Rust Compiler

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 9, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 12 candidates

@rust-log-analyzer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants