about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-09-18 11:04:26 -0500
committerGitHub <noreply@github.com>2017-09-18 11:04:26 -0500
commit3bbe15376c6e77d2a17b2261cdb503bf0bbbbbf4 (patch)
treee8acabdb27fbd9b62b1d528df0ebfc1eaf2b6175
parent64c9fd6832b305983ad638c3c3b10aef4c276443 (diff)
parente47279f51212a749d7cfe1d38a27f10a842d97a5 (diff)
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">
-rw-r--r--src/librustdoc/html/render.rs8
-rw-r--r--src/librustdoc/html/static/rustdoc.css12
2 files changed, 15 insertions, 5 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index c09ce4c4bd3..bf0fe5f6e9d 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -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,
@@ -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,
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index c15051376bf..50c0424aa5f 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -288,6 +288,7 @@ nav.sub {
 
 .docblock {
 	margin-left: 24px;
+	position: relative;
 }
 
 .content .out-of-band {
@@ -456,8 +457,13 @@ a {
 }
 .anchor {
 	display: none;
+	position: absolute;
+	left: -25px;
 }
-.anchor:after {
+.anchor.field {
+	left: -20px;
+}
+.anchor:before {
 	content: '\2002\00a7\2002';
 }
 
@@ -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';
 }