about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/html/markdown.rs2
-rw-r--r--src/librustdoc/html/markdown/tests.rs47
-rw-r--r--src/librustdoc/html/render/mod.rs2
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css21
-rw-r--r--src/test/rustdoc-gui/anchors.goml42
-rw-r--r--src/test/rustdoc-gui/headers-color.goml9
6 files changed, 18 insertions, 105 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index a40181352f6..1c0448828a2 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -565,7 +565,7 @@ impl<'a, 'b, 'ids, I: Iterator<Item = SpannedEvent<'a>>> Iterator
             self.buf.push_back((Event::Html(format!("</a></h{}>", level).into()), 0..0));
 
             let start_tags = format!(
-                "<h{level} id=\"{id}\" class=\"section-header\">\
+                "<h{level} id=\"{id}\">\
                     <a href=\"#{id}\">",
                 id = id,
                 level = level
diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs
index ea6575d179d..5c0bf0ed942 100644
--- a/src/librustdoc/html/markdown/tests.rs
+++ b/src/librustdoc/html/markdown/tests.rs
@@ -159,25 +159,22 @@ fn test_header() {
         assert_eq!(output, expect, "original: {}", input);
     }
 
-    t(
-        "# Foo bar",
-        "<h2 id=\"foo-bar\" class=\"section-header\"><a href=\"#foo-bar\">Foo bar</a></h2>",
-    );
+    t("# Foo bar", "<h2 id=\"foo-bar\"><a href=\"#foo-bar\">Foo bar</a></h2>");
     t(
         "## Foo-bar_baz qux",
-        "<h3 id=\"foo-bar_baz-qux\" class=\"section-header\">\
+        "<h3 id=\"foo-bar_baz-qux\">\
          <a href=\"#foo-bar_baz-qux\">Foo-bar_baz qux</a></h3>",
     );
     t(
         "### **Foo** *bar* baz!?!& -_qux_-%",
-        "<h4 id=\"foo-bar-baz--qux-\" class=\"section-header\">\
+        "<h4 id=\"foo-bar-baz--qux-\">\
             <a href=\"#foo-bar-baz--qux-\"><strong>Foo</strong> \
             <em>bar</em> baz!?!&amp; -<em>qux</em>-%</a>\
          </h4>",
     );
     t(
         "#### **Foo?** & \\*bar?!*  _`baz`_ ❤ #qux",
-        "<h5 id=\"foo--bar--baz--qux\" class=\"section-header\">\
+        "<h5 id=\"foo--bar--baz--qux\">\
              <a href=\"#foo--bar--baz--qux\"><strong>Foo?</strong> &amp; *bar?!*  \
              <em><code>baz</code></em> ❤ #qux</a>\
          </h5>",
@@ -201,36 +198,12 @@ fn test_header_ids_multiple_blocks() {
         assert_eq!(output, expect, "original: {}", input);
     }
 
-    t(
-        &mut map,
-        "# Example",
-        "<h2 id=\"example\" class=\"section-header\"><a href=\"#example\">Example</a></h2>",
-    );
-    t(
-        &mut map,
-        "# Panics",
-        "<h2 id=\"panics\" class=\"section-header\"><a href=\"#panics\">Panics</a></h2>",
-    );
-    t(
-        &mut map,
-        "# Example",
-        "<h2 id=\"example-1\" class=\"section-header\"><a href=\"#example-1\">Example</a></h2>",
-    );
-    t(
-        &mut map,
-        "# Search",
-        "<h2 id=\"search-1\" class=\"section-header\"><a href=\"#search-1\">Search</a></h2>",
-    );
-    t(
-        &mut map,
-        "# Example",
-        "<h2 id=\"example-2\" class=\"section-header\"><a href=\"#example-2\">Example</a></h2>",
-    );
-    t(
-        &mut map,
-        "# Panics",
-        "<h2 id=\"panics-1\" class=\"section-header\"><a href=\"#panics-1\">Panics</a></h2>",
-    );
+    t(&mut map, "# Example", "<h2 id=\"example\"><a href=\"#example\">Example</a></h2>");
+    t(&mut map, "# Panics", "<h2 id=\"panics\"><a href=\"#panics\">Panics</a></h2>");
+    t(&mut map, "# Example", "<h2 id=\"example-1\"><a href=\"#example-1\">Example</a></h2>");
+    t(&mut map, "# Search", "<h2 id=\"search-1\"><a href=\"#search-1\">Search</a></h2>");
+    t(&mut map, "# Example", "<h2 id=\"example-2\"><a href=\"#example-2\">Example</a></h2>");
+    t(&mut map, "# Panics", "<h2 id=\"panics-1\"><a href=\"#panics-1\">Panics</a></h2>");
 }
 
 #[test]
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index f3e65df6b14..19b5fef4e09 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -2567,7 +2567,7 @@ fn render_call_locations(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item) {
         w,
         "<div class=\"docblock scraped-example-list\">\
           <span></span>\
-          <h5 id=\"{id}\" class=\"section-header\">\
+          <h5 id=\"{id}\">\
              <a href=\"#{id}\">Examples found in repository</a>\
           </h5>",
         id = id
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 04112c9779b..78e7c97d71d 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1141,16 +1141,6 @@ a.test-arrow {
 a.test-arrow:hover{
 	text-decoration: none;
 }
-.section-header:hover a:before {
-	position: absolute;
-	left: -25px;
-	padding-right: 10px; /* avoid gap that causes hover to disappear */
-	content: '\2002\00a7\2002';
-}
-
-.section-header:hover a {
-	text-decoration: none;
-}
 
 .code-attribute {
 	font-weight: 300;
@@ -1196,17 +1186,6 @@ h3.variant {
 	margin-top: 3px;
 }
 
-.top-doc .docblock > .section-header:first-child {
-	margin-left: 15px;
-}
-.top-doc .docblock > .section-header:first-child:hover > a:before {
-	left: -10px;
-}
-
-.docblock > .section-header:first-child {
-	margin-top: 0;
-}
-
 :target > code, :target > .code-header {
 	opacity: 1;
 }
diff --git a/src/test/rustdoc-gui/anchors.goml b/src/test/rustdoc-gui/anchors.goml
index 26e4503a5d0..ddfb23a4f86 100644
--- a/src/test/rustdoc-gui/anchors.goml
+++ b/src/test/rustdoc-gui/anchors.goml
@@ -31,46 +31,4 @@ assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"})
 move-cursor-to: "#impl"
 assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"})
 
-// Now we check the positions: only the first heading of the top doc comment should
-// have a different position.
-move-cursor-to: ".top-doc .docblock .section-header:first-child"
-assert-css: (
-    ".top-doc .docblock .section-header:first-child > a::before",
-    {"left": "-10px", "padding-right": "10px"},
-)
-// We also check that the heading itself has a different indent.
-assert-css: (".top-doc .docblock .section-header:first-child", {"margin-left": "15px"})
-
-move-cursor-to: ".top-doc .docblock .section-header:not(:first-child)"
-assert-css: (
-    ".top-doc .docblock .section-header:not(:first-child) > a::before",
-    {"left": "-25px", "padding-right": "10px"},
-)
-assert-css: (".top-doc .docblock .section-header:not(:first-child)", {"margin-left": "0px"})
-
-// Now let's check some other docblock headings...
-// First the impl block docs.
-move-cursor-to: "#title-for-struct-impl-doc"
-assert-css: (
-    "#title-for-struct-impl-doc > a::before",
-    {"left": "-25px", "padding-right": "10px"},
-)
-assert-css: ("#title-for-struct-impl-doc", {"margin-left": "0px"})
-// Now a method docs.
-move-cursor-to: "#title-for-struct-impl-item-doc"
-assert-css: (
-    "#title-for-struct-impl-item-doc > a::before",
-    {"left": "-25px", "padding-right": "10px"},
-)
 assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
-
-// Finally, we want to ensure that if the first element of the doc block isn't a heading,
-// if there is a heading afterwards, it won't have the indent.
-goto: file://|DOC_PATH|/test_docs/enum.WhoLetTheDogOut.html
-
-move-cursor-to: ".top-doc .docblock .section-header"
-assert-css: (
-    ".top-doc .docblock .section-header > a::before",
-    {"left": "-25px", "padding-right": "10px"},
-)
-assert-css: (".top-doc .docblock .section-header", {"margin-left": "0px"})
diff --git a/src/test/rustdoc-gui/headers-color.goml b/src/test/rustdoc-gui/headers-color.goml
index d58ca13a629..cf9caa2d586 100644
--- a/src/test/rustdoc-gui/headers-color.goml
+++ b/src/test/rustdoc-gui/headers-color.goml
@@ -40,7 +40,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
 assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL)
 
 goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
-assert-css: (".section-header a", {"color": "rgb(57, 175, 215)"}, ALL)
+// We select headings (h2, h3, h...).
+assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL)
 
 // Dark theme
 local-storage: {
@@ -78,7 +79,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
 assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
 
 goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
-assert-css: (".section-header a", {"color": "rgb(210, 153, 29)"}, ALL)
+// We select headings (h2, h3, h...).
+assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL)
 
 // Light theme
 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
@@ -111,4 +113,5 @@ goto: file://|DOC_PATH|/test_docs/index.html
 assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
 
 goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
-assert-css: (".section-header a", {"color": "rgb(56, 115, 173)"}, ALL)
+// We select headings (h2, h3, h...).
+assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL)