about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-01-26 01:51:17 -0500
committerGitHub <noreply@github.com>2025-01-26 01:51:17 -0500
commita70b0d5bdd4358b961fd62366d80174147c09a7e (patch)
treee60317422809d8cefdf2ab89322d70c162d13fd2
parent666aaf912846337e9c2d2594f7be6f8483e05343 (diff)
parent1d97a3e4d7f833675a8c5ae1120db915c99474d9 (diff)
downloadrust-a70b0d5bdd4358b961fd62366d80174147c09a7e.tar.gz
rust-a70b0d5bdd4358b961fd62366d80174147c09a7e.zip
Rollup merge of #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.
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css9
-rw-r--r--src/librustdoc/html/templates/print_item.html4
2 files changed, 5 insertions, 8 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index a7b462936cc..f487d66edac 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -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
diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html
index 9fd575b2751..62954dbb023 100644
--- a/src/librustdoc/html/templates/print_item.html
+++ b/src/librustdoc/html/templates/print_item.html
@@ -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}}