diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-02-09 14:43:44 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-02-09 14:43:44 +0100 |
| commit | 6aad08f13ffba2a18428c4f5ad03977bc1503f5d (patch) | |
| tree | 22b097e18b810b53005b3a582fce8d176b014ec9 | |
| parent | 1f0a96862ac9d4c6ca3e4bb500c8b9eac4d83049 (diff) | |
| download | rust-6aad08f13ffba2a18428c4f5ad03977bc1503f5d.tar.gz rust-6aad08f13ffba2a18428c4f5ad03977bc1503f5d.zip | |
Unify headings indent and remove useless anchor
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown/tests.rs | 20 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 21 |
4 files changed, 12 insertions, 33 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..6b44e447b51 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -161,23 +161,23 @@ fn test_header() { t( "# Foo bar", - "<h2 id=\"foo-bar\" class=\"section-header\"><a href=\"#foo-bar\">Foo bar</a></h2>", + "<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!?!& -<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> & *bar?!* \ <em><code>baz</code></em> ❤ #qux</a>\ </h5>", @@ -204,32 +204,32 @@ fn test_header_ids_multiple_blocks() { t( &mut map, "# Example", - "<h2 id=\"example\" class=\"section-header\"><a href=\"#example\">Example</a></h2>", + "<h2 id=\"example\"><a href=\"#example\">Example</a></h2>", ); t( &mut map, "# Panics", - "<h2 id=\"panics\" class=\"section-header\"><a href=\"#panics\">Panics</a></h2>", + "<h2 id=\"panics\"><a href=\"#panics\">Panics</a></h2>", ); t( &mut map, "# Example", - "<h2 id=\"example-1\" class=\"section-header\"><a href=\"#example-1\">Example</a></h2>", + "<h2 id=\"example-1\"><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>", + "<h2 id=\"search-1\"><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>", + "<h2 id=\"example-2\"><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>", + "<h2 id=\"panics-1\"><a href=\"#panics-1\">Panics</a></h2>", ); } 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; } |
