Skip to content

Commit

Permalink
Add more links and put the link character to the left
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 17, 2017
1 parent 1cdd689 commit e47279f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2671,8 +2671,9 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
let ns_id = derive_id(format!("{}.{}",
field.name.as_ref().unwrap(),
ItemType::StructField.name_space()));
write!(w, "<span id='{id}' class=\"{item_type}\">
<span id='{ns_id}' class='invisible'>
write!(w, "<span id=\"{id}\" class=\"{item_type} small-section-header\">
<a href=\"#{id}\" class=\"anchor field\"></a>
<span id=\"{ns_id}\" class='invisible'>
<code>{name}: {ty}</code>
</span></span>",
item_type = ItemType::StructField,
Expand Down Expand Up @@ -2793,7 +2794,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
let ns_id = derive_id(format!("{}.{}",
variant.name.as_ref().unwrap(),
ItemType::Variant.name_space()));
write!(w, "<span id='{id}' class='variant'>\
write!(w, "<span id=\"{id}\" class=\"variant small-section-header\">\
<a href=\"#{id}\" class=\"anchor field\"></a>\
<span id='{ns_id}' class='invisible'><code>{name}",
id = id,
ns_id = ns_id,
Expand Down
12 changes: 10 additions & 2 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ nav.sub {

.docblock {
margin-left: 24px;
position: relative;
}

.content .out-of-band {
Expand Down Expand Up @@ -456,8 +457,13 @@ a {
}
.anchor {
display: none;
position: absolute;
left: -25px;
}
.anchor:after {
.anchor.field {
left: -20px;
}
.anchor:before {
content: '\2002\00a7\2002';
}

Expand Down Expand Up @@ -625,7 +631,9 @@ a.test-arrow:hover{
text-decoration: none;
}

.section-header:hover a:after {
.section-header:hover a:before {
position: absolute;
left: -25px;
content: '\2002\00a7\2002';
}

Expand Down

0 comments on commit e47279f

Please sign in to comment.