Skip to content

Commit

Permalink
Unrolled build for rust-lang#135946
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#135946 - kornelski:rustdoc-path-space, r=notriddle

Remove extra whitespace from rustdoc breadcrumbs for copypasting

The docs header used to display [item names with their full path](https://doc.rust-lang.org/1.82.0/std/os/unix/ffi/trait.OsStrExt.html), but a [recent design change](https://doc.rust-lang.org/1.83.0/std/os/unix/ffi/trait.OsStrExt.html) has split the path and added extra styling to it.

The problem is the new styling affects how this text is copied to clipboard. I used to copy and paste the paths into `use` statements in the code, but the new styling has extra formatting and whitespace that makes copied text unusable in Rust source code.

Instead of:

>  std::os::unix::ffi::OsStrExt

I now get:

> std
> ::
> os
> ::
> unix
> ::
> ffi
> Trait OsStrExt

This change removes extra whitespace from the markup, and removes `display: flex`. Paths (now in small text) are unlikely to be that long to wrap, and even then regular text wrapping should be sufficient.
  • Loading branch information
rust-timer authored Jan 26, 2025
2 parents d9b4598 + 1d97a3e commit 8a8f16e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,12 @@ h1, h2, h3, h4 {
.rustdoc-breadcrumbs {
grid-area: main-heading-breadcrumbs;
line-height: 1.25;
display: flex;
flex-wrap: wrap;
align-items: end;
padding-top: 5px;
position: relative;
z-index: 1;
}
.rustdoc-breadcrumbs a {
padding: 4px 0;
margin: -4px 0;
z-index: 1;
padding: 5px 0 7px;
}
/* The only headings that get underlines are:
Markdown-generated headings within the top-doc
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/templates/print_item.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="main-heading">
{% if !path_components.is_empty() %}
<span class="rustdoc-breadcrumbs">
<div class="rustdoc-breadcrumbs">
{% for (i, component) in path_components.iter().enumerate() %}
{% if i != 0 %}
::<wbr>
{% endif %}
<a href="{{component.path|safe}}index.html">{{component.name}}</a>
{% endfor %}
</span>
</div>
{% endif %}
<h1>
{{typ}}
Expand Down

0 comments on commit 8a8f16e

Please sign in to comment.