Skip to content

Commit 8f998d3

Browse files
authored
Rollup merge of #44661 - GuillaumeGomez:more-links, r=QuietMisdreavus
Add more links and put the link character to the left r? @QuietMisdreavus And of course, a few screenshots: <img width="1440" alt="screen shot 2017-09-17 at 22 08 46" src="https://user-images.githubusercontent.com/3050060/30524496-44a50208-9bf5-11e7-942e-a3707ba125c3.png"> <img width="1440" alt="screen shot 2017-09-17 at 22 09 47" src="https://user-images.githubusercontent.com/3050060/30524502-49068dbc-9bf5-11e7-8e59-ec38664e0e0f.png"> <img width="1440" alt="screen shot 2017-09-17 at 22 10 56" src="https://user-images.githubusercontent.com/3050060/30524503-491c8c34-9bf5-11e7-9ce5-f1bd5ef8600b.png">
2 parents 97990cd + e47279f commit 8f998d3

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/librustdoc/html/render.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -2671,8 +2671,9 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
26712671
let ns_id = derive_id(format!("{}.{}",
26722672
field.name.as_ref().unwrap(),
26732673
ItemType::StructField.name_space()));
2674-
write!(w, "<span id='{id}' class=\"{item_type}\">
2675-
<span id='{ns_id}' class='invisible'>
2674+
write!(w, "<span id=\"{id}\" class=\"{item_type} small-section-header\">
2675+
<a href=\"#{id}\" class=\"anchor field\"></a>
2676+
<span id=\"{ns_id}\" class='invisible'>
26762677
<code>{name}: {ty}</code>
26772678
</span></span>",
26782679
item_type = ItemType::StructField,
@@ -2793,7 +2794,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
27932794
let ns_id = derive_id(format!("{}.{}",
27942795
variant.name.as_ref().unwrap(),
27952796
ItemType::Variant.name_space()));
2796-
write!(w, "<span id='{id}' class='variant'>\
2797+
write!(w, "<span id=\"{id}\" class=\"variant small-section-header\">\
2798+
<a href=\"#{id}\" class=\"anchor field\"></a>\
27972799
<span id='{ns_id}' class='invisible'><code>{name}",
27982800
id = id,
27992801
ns_id = ns_id,

src/librustdoc/html/static/rustdoc.css

+10-2
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ nav.sub {
288288

289289
.docblock {
290290
margin-left: 24px;
291+
position: relative;
291292
}
292293

293294
.content .out-of-band {
@@ -456,8 +457,13 @@ a {
456457
}
457458
.anchor {
458459
display: none;
460+
position: absolute;
461+
left: -25px;
459462
}
460-
.anchor:after {
463+
.anchor.field {
464+
left: -20px;
465+
}
466+
.anchor:before {
461467
content: '\2002\00a7\2002';
462468
}
463469

@@ -625,7 +631,9 @@ a.test-arrow:hover{
625631
text-decoration: none;
626632
}
627633

628-
.section-header:hover a:after {
634+
.section-header:hover a:before {
635+
position: absolute;
636+
left: -25px;
629637
content: '\2002\00a7\2002';
630638
}
631639

0 commit comments

Comments
 (0)