Skip to content

fix: Fix some subtle bugs in docs rendering - #23235

Open
ChayimFriedman2 wants to merge 1 commit into
rust-lang:masterfrom
ChayimFriedman2:docs-sugar-rustdoc
Open

fix: Fix some subtle bugs in docs rendering#23235
ChayimFriedman2 wants to merge 1 commit into
rust-lang:masterfrom
ChayimFriedman2:docs-sugar-rustdoc

Conversation

@ChayimFriedman2

@ChayimFriedman2 ChayimFriedman2 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Match the behavior of rustdoc precisely:

  • Fix handling of mixed sugared and desugared docs.
  • Only trim spaces and tabs for indentation.
  • Do not use a separate indentation for outlined module.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2026

<span class="comment documentation">/// ```rust</span>
<span class="comment documentation">///</span><span class="none injected"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="punctuation injected">_</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="function injected">example</span><span class="parenthesis injected">(</span><span class="operator injected">&</span><span class="bracket injected">[</span><span class="numeric_literal injected">1</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">2</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">3</span><span class="bracket injected">]</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span>
<span class="comment documentation">/// </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="punctuation injected">_</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="function injected">example</span><span class="parenthesis injected">(</span><span class="operator injected">&</span><span class="bracket injected">[</span><span class="numeric_literal injected">1</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">2</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">3</span><span class="bracket injected">]</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span>

@ChayimFriedman2 ChayimFriedman2 Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This test only removed the none injected classes for the leading space, since it's now trimmed as indentation thus unmapped. No real effect.

View changes since the review

---
\<- ` ` here
 \<- ` ` here

@ChayimFriedman2 ChayimFriedman2 Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I verified with the JSON version of rustdoc that we should indeed emit this non-ASCII space here (besides the fact that I copied that from rustdoc's code).

View changes since the review

@rustbot

This comment has been minimized.

Match the behavior of rustdoc *precisely*:
 - Fix handling of mixed sugared and desugared docs.
 - Only trim spaces and tabs for indentation.
@rustbot

rustbot commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants