Unify headings indent and remove useless anchor

This commit is contained in:
Guillaume Gomez 2022-02-09 14:43:44 +01:00
parent 1f0a96862a
commit 6aad08f13f
4 changed files with 12 additions and 33 deletions

View File

@ -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

View File

@ -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!?!&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>",
@ -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>",
);
}

View File

@ -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

View File

@ -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;
}