Skip to content

fix code blocks in doc comments inconsistently using 3 or 4 spaces of indentation #13261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

antonilol
Copy link
Contributor

@antonilol antonilol commented Aug 12, 2024

The metadata collector script was treating the space lines all start with as indentation. This caused code block's triple backticks to get a space in front of it, like this:

 ```rust
^ this space

Code after that that is indented with 4 spaces will only have 3 of those rendered.
Example (taken from here):

...
pub fn divide_by(x: i32, y: i32) -> i32 {
   if y == 0 {                      // 3 spaces
       panic!("Cannot divide by 0") // 7 spaces
...

Also added 'compile_fail' alongside the other rustdoc directives (second code block here had no highlighting), fixed a doc comment using 'rs' instead of 'rust' and removed some spaces causing an extra missing space of indentation (see second code block here).

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Aug 12, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Centri3 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 12, 2024
Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

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

@rustbot rustbot assigned xFrednet and unassigned Centri3 Aug 12, 2024
@xFrednet
Copy link
Member

Nice catch, thank you for the PR :D

cc: @Alexendoo this adds a slight modification to the metadata collector. You'll likely have to rebase your PR and copy the changes as well #13221


Roses are red,
•Violets are blue,
••Spaces are added,
•••Indention is cool,

@bors
Copy link
Contributor

bors commented Aug 12, 2024

📌 Commit d7f1252 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Aug 12, 2024

⌛ Testing commit d7f1252 with merge e070784...

@bors
Copy link
Contributor

bors commented Aug 12, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing e070784 to master...

@bors bors merged commit e070784 into rust-lang:master Aug 12, 2024
8 checks passed
@antonilol antonilol deleted the fix-doc-code-blocks branch August 12, 2024 21:36
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.

5 participants