Skip to content

Commit a70b0d5

Browse files
authored
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.
2 parents 666aaf9 + 1d97a3e commit a70b0d5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/librustdoc/html/static/css/rustdoc.css

+3-6
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,12 @@ h1, h2, h3, h4 {
192192
.rustdoc-breadcrumbs {
193193
grid-area: main-heading-breadcrumbs;
194194
line-height: 1.25;
195-
display: flex;
196-
flex-wrap: wrap;
197-
align-items: end;
198195
padding-top: 5px;
196+
position: relative;
197+
z-index: 1;
199198
}
200199
.rustdoc-breadcrumbs a {
201-
padding: 4px 0;
202-
margin: -4px 0;
203-
z-index: 1;
200+
padding: 5px 0 7px;
204201
}
205202
/* The only headings that get underlines are:
206203
Markdown-generated headings within the top-doc

src/librustdoc/html/templates/print_item.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<div class="main-heading">
22
{% if !path_components.is_empty() %}
3-
<span class="rustdoc-breadcrumbs">
3+
<div class="rustdoc-breadcrumbs">
44
{% for (i, component) in path_components.iter().enumerate() %}
55
{% if i != 0 %}
66
::<wbr>
77
{% endif %}
88
<a href="{{component.path|safe}}index.html">{{component.name}}</a>
99
{% endfor %}
10-
</span>
10+
</div>
1111
{% endif %}
1212
<h1>
1313
{{typ}}

0 commit comments

Comments
 (0)