Skip to content

Fix code block whitespace handling in Markdown#155040

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
yalagadapavankumar:fix-whitespace
Apr 10, 2026
Merged

Fix code block whitespace handling in Markdown#155040
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
yalagadapavankumar:fix-whitespace

Conversation

@yalagadapavankumar
Copy link
Copy Markdown
Contributor

@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.

Copy link
Copy Markdown
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I think this is now the expected markdown behaviour. Good tests 🙂

We'll just need someone who has merge permissions to approve now.

View changes since this review

Copy link
Copy Markdown
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! @bors r+ rollup

View changes since this review

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 10, 2026

📌 Commit ef3a89c has been approved by JohnTitor

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 10, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 10, 2026
… r=JohnTitor

Fix code block whitespace handling in Markdown

### 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](rustfoundation/interop-initiative#53)
rust-bors bot pushed a commit that referenced this pull request Apr 10, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #155047 (Always exhaustively match on typing mode)
 - #155080 (Simplify `try_load_from_disk_fn`.)
 - #152384 (Restrict EII declarations to functions at lowering time)
 - #153796 (Fix ICE when combining #[eii] with #[core::contracts::ensures])
 - #154369 (Fix `pattern_from_macro_note` for bit-or expr)
 - #155027 ( Rename some more of our internal `#[rustc_*]` TEST attributes)
 - #155031 (delegation: fix unelided lifetime ICE, refactoring of GenericArgPosition)
 - #155040 (Fix code block whitespace handling in Markdown)
rust-timer added a commit that referenced this pull request Apr 10, 2026
Rollup merge of #155040 - yalagadapavankumar:fix-whitespace, r=JohnTitor

Fix code block whitespace handling in Markdown

### 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](rustfoundation/interop-initiative#53)
@rust-bors rust-bors bot merged commit eec05ee into rust-lang:main Apr 10, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 10, 2026
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 13, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#155047 (Always exhaustively match on typing mode)
 - rust-lang/rust#155080 (Simplify `try_load_from_disk_fn`.)
 - rust-lang/rust#152384 (Restrict EII declarations to functions at lowering time)
 - rust-lang/rust#153796 (Fix ICE when combining #[eii] with #[core::contracts::ensures])
 - rust-lang/rust#154369 (Fix `pattern_from_macro_note` for bit-or expr)
 - rust-lang/rust#155027 ( Rename some more of our internal `#[rustc_*]` TEST attributes)
 - rust-lang/rust#155031 (delegation: fix unelided lifetime ICE, refactoring of GenericArgPosition)
 - rust-lang/rust#155040 (Fix code block whitespace handling in Markdown)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants