mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Unify headings indent and remove useless anchor
This commit is contained in:
parent
1f0a96862a
commit
6aad08f13f
@ -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
|
||||
|
@ -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>",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user