diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index abc27bcdf07..6a48b9367b8 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -558,12 +558,10 @@ impl<'a, 'b, 'ids, I: Iterator- >> Iterator
let level =
std::cmp::min(level as u32 + (self.heading_offset as u32), MAX_HEADER_LEVEL);
- self.buf.push_back((Event::Html(format!("").into()), 0..0));
+ self.buf.push_back((Event::Html(format!("").into()), 0..0));
- let start_tags = format!(
- "\
- ",
- );
+ let start_tags =
+ format!("§");
return Some((Event::Html(start_tags.into()), 0..0));
}
event
diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs
index 5eba1d0609f..fcf77783024 100644
--- a/src/librustdoc/html/markdown/tests.rs
+++ b/src/librustdoc/html/markdown/tests.rs
@@ -311,24 +311,29 @@ fn test_header() {
assert_eq!(output, expect, "original: {}", input);
}
- t("# Foo bar", "");
+ t(
+ "# Foo bar",
+ "
§Foo bar
",
+ );
t(
"## Foo-bar_baz qux",
"",
+ §\
+ Foo-bar_baz qux\
+ ",
);
t(
"### **Foo** *bar* baz!?!& -_qux_-%",
"",
);
t(
"#### **Foo?** & \\*bar?!* _`baz`_ ❤ #qux",
"",
);
}
@@ -351,12 +356,36 @@ fn test_header_ids_multiple_blocks() {
assert_eq!(output, expect, "original: {}", input);
}
- t(&mut map, "# Example", "");
- t(&mut map, "# Panics", "");
- t(&mut map, "# Example", "");
- t(&mut map, "# Search", "");
- t(&mut map, "# Example", "");
- t(&mut map, "# Panics", "");
+ t(
+ &mut map,
+ "# Example",
+ "§Example
",
+ );
+ t(
+ &mut map,
+ "# Panics",
+ "§Panics
",
+ );
+ t(
+ &mut map,
+ "# Example",
+ "§Example
",
+ );
+ t(
+ &mut map,
+ "# Search",
+ "§Search
",
+ );
+ t(
+ &mut map,
+ "# Example",
+ "§Example
",
+ );
+ t(
+ &mut map,
+ "# Panics",
+ "§Panics
",
+ );
}
#[test]
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index b898eb5d381..22fe5d8b0cf 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -765,6 +765,9 @@ nav.sub {
h2.section-header > .anchor {
padding-right: 6px;
}
+.doc-anchor {
+ margin-right: 6px;
+}
.main-heading a:hover,
.example-wrap .rust a:hover,