From 8ac43366929e2ea66abbf0fc8fe535ecfbea0262 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 8 Aug 2017 22:16:08 +0200 Subject: [PATCH] Improve headers linking --- src/librustdoc/html/render.rs | 44 +++++++++++++------------- src/librustdoc/html/static/rustdoc.css | 10 ++++++ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index fc0adef70baa1..563c5618759b7 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2141,8 +2141,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, if !types.is_empty() { write!(w, " -

- Associated Types +

+ Associated Types

")?; @@ -2154,8 +2154,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, if !consts.is_empty() { write!(w, " -

- Associated Constants +

+ Associated Constants

")?; @@ -2168,8 +2168,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, // Output the documentation for each function individually if !required.is_empty() { write!(w, " -

- Required Methods +

+ Required Methods

")?; @@ -2180,8 +2180,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, } if !provided.is_empty() { write!(w, " -

- Provided Methods +

+ Provided Methods

")?; @@ -2196,8 +2196,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, let cache = cache(); write!(w, " -

- Implementors +

+ Implementors

    ")?; @@ -2436,8 +2436,8 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, }).peekable(); if let doctree::Plain = s.struct_type { if fields.peek().is_some() { - write!(w, "

    - Fields

    ")?; + write!(w, "

    + Fields

    ")?; for (field, ty) in fields { let id = derive_id(format!("{}.{}", ItemType::StructField, @@ -2485,8 +2485,8 @@ fn item_union(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, } }).peekable(); if fields.peek().is_some() { - write!(w, "

    - Fields

    ")?; + write!(w, "

    + Fields

    ")?; for (field, ty) in fields { write!(w, "{name}: {ty} ", @@ -2558,8 +2558,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, document(w, cx, it)?; if !e.variants.is_empty() { - write!(w, "

    - Variants

    \n")?; + write!(w, "

    + Variants

    \n")?; for variant in &e.variants { let id = derive_id(format!("{}.{}", ItemType::Variant, @@ -2831,16 +2831,16 @@ fn render_assoc_items(w: &mut fmt::Formatter, let render_mode = match what { AssocItemRender::All => { write!(w, " -

    - Methods +

    + Methods

    ")?; RenderMode::Normal } AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => { write!(w, " -

    - Methods from {}<Target = {}> +

    + Methods from {}<Target = {}>

    ", trait_, type_)?; RenderMode::ForDeref { mut_: deref_mut_ } @@ -2865,8 +2865,8 @@ fn render_assoc_items(w: &mut fmt::Formatter, render_deref_methods(w, cx, impl_, containing_item, has_deref_mut)?; } write!(w, " -

    - Trait Implementations +

    + Trait Implementations

    ")?; for i in &traits { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 51465bafc42e2..24c0ec04fa182 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -438,6 +438,16 @@ a { background: transparent; } +.small-section-header:hover > .anchor { + display: initial; +} +.anchor { + display: none; +} +.anchor:after { + content: '\2002\00a7\2002'; +} + .docblock a:hover, .docblock-short a:hover, .stability a { text-decoration: underline; }