Skip to content

[bug] Inline code block starting with space is trimmed #65555

New issue

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

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

Already on GitHub? # to your account

Closed
jhpratt opened this issue Oct 18, 2019 · 5 comments · Fixed by #65613
Closed

[bug] Inline code block starting with space is trimmed #65555

jhpratt opened this issue Oct 18, 2019 · 5 comments · Fixed by #65613
Assignees
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jhpratt
Copy link
Member

jhpratt commented Oct 18, 2019

In some documentation that I recently wrote, I had an inline code block that has a leading space.

` 5`

This is rendered as <code>5</code> — notice the lack of a leading space.

Given that the documentation in question is literally to show how a leading space is added, and given that code blocks otherwise display content as-is, this seems like a bug to me.

Reference for full source code in case this behavior isn't consistent: https://github.com/time-rs/time/blob/7dc4cf32c48d4e5113661423b4869b5015decb64/src/lib.rs#L80-L84

@pietroalbini pietroalbini transferred this issue from rust-lang/docs.rs Oct 18, 2019
@pietroalbini
Copy link
Member

Thanks for opening this issue @jhpratt! I moved this issue from rust-lang/docs.rs to rust-lang/rust as this is a rustdoc bug (docs.rs just calls rustdoc to build the documentation).

@Mark-Simulacrum Mark-Simulacrum added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 18, 2019
@JohnTitor JohnTitor added the C-bug Category: This is a bug. label Oct 18, 2019
@jhpratt
Copy link
Member Author

jhpratt commented Oct 18, 2019

Thanks! Wasn't sure if rustdoc had its own repo.

@Mark-Simulacrum
Copy link
Member

Fix is in #65613.

@jhpratt
Copy link
Member Author

jhpratt commented Oct 19, 2019

Thanks @Mark-Simulacrum!

@GuillaumeGomez
Copy link
Member

As discussed in #65613, better keep it as is and let users decide what they want on their own.

pietroalbini added a commit to pietroalbini/rust that referenced this issue Nov 25, 2019
…, r=GuillaumeGomez

Preserve whitespace inside one-backtick codeblocks

Previously this was only done inside short docblocks (e.g., summary
lines), but we should also do so in general.

Fixes rust-lang#65555
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants