Skip to content

Inline code has collapsed whitespace #83550

Closed
@mgeisler

Description

@mgeisler

Code

When documenting the handling of whitespace in the textwrap crate, I noticed that whitespace is collapsed in inline code. That is,

`"   foo   "`

is rendered the same as

`" foo "`

Test it with

$ cargo new --lib whitespace && cd whitespace && echo '//! `"   foo   "`' > src/lib.rs && cargo doc --open

Version it worked on

It worked on Rust 1.50:

image

Version with regression

It stopped working on Rust 1.51. I tracked down the change to #81558, which removed white-space: pre-wrap from the CSS. The page now looks like this:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.P-highHigh priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions