Skip to content

Commit 542ab2d

Browse files
committed
Outdent method headings so they stand out
The makes the heading / documentation distinction clearer.
1 parent 0119879 commit 542ab2d

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/librustdoc/html/static/css/rustdoc.css

+10-18
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,15 @@ h1.fqn > .in-band > a:hover {
152152
h2, h3, h4 {
153153
border-bottom: 1px solid;
154154
}
155-
h3.code-header, h4.code-header {
155+
h3.code-header {
156+
font-size: 1.1em;
157+
}
158+
h4.code-header {
156159
font-size: 1em;
160+
}
161+
h3.code-header, h4.code-header {
157162
font-weight: 600;
158-
border: none;
163+
border-bottom-style: none;
159164
padding: 0;
160165
margin: 0;
161166
}
@@ -174,12 +179,6 @@ h3.code-header, h4.code-header {
174179
margin-bottom: 10px;
175180
position: relative;
176181
}
177-
.impl, .method.trait-impl,
178-
.type.trait-impl,
179-
.associatedconstant.trait-impl,
180-
.associatedtype.trait-impl {
181-
padding-left: 15px;
182-
}
183182

184183
div.impl-items > div {
185184
padding-left: 0;
@@ -669,13 +668,6 @@ nav.sub {
669668
left: -19px;
670669
}
671670

672-
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant,
673-
.impl-items > .associatedtype, .content .impl-items details > summary > .type,
674-
.impl-items details > summary > .associatedconstant,
675-
.impl-items details > summary > .associatedtype {
676-
margin-left: 20px;
677-
}
678-
679671
.content .impl-items .docblock, .content .impl-items .item-info {
680672
margin-bottom: .6em;
681673
}
@@ -746,7 +738,7 @@ a {
746738
.anchor {
747739
display: none;
748740
position: absolute;
749-
left: 0;
741+
left: -0.5em;
750742
background: none !important;
751743
}
752744
.anchor.field {
@@ -1579,14 +1571,14 @@ details.rustdoc-toggle > summary.hideme::before {
15791571

15801572
details.rustdoc-toggle > summary:not(.hideme)::before {
15811573
position: absolute;
1582-
left: -23px;
1574+
left: -24px;
15831575
top: 3px;
15841576
}
15851577

15861578
.impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
15871579
.undocumented > details.rustdoc-toggle > summary:not(.hideme)::before {
15881580
position: absolute;
1589-
left: -2px;
1581+
left: -24px;
15901582
}
15911583

15921584
/* When a "hideme" summary is open and the "Expand description" or "Show
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// The `impl Foo` heading underneath `Implementations` has a §
2+
// anchor to its left (used for linking to that heading). The anchor only shows
3+
// up when hovering the `impl Foo`. This test ensures there's no gap between the
4+
// anchor and the `impl Foo`. If there were a gap, this would cause an annoying
5+
// problem: you hover `impl Foo` to see the anchor, then when you move your
6+
// mouse to the left, the anchor disappears before you reach it.
7+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
8+
// We check that ".item-info" is bigger than its content.
9+
move-cursor-to: ".impl"
10+
assert-property: (".impl > a.anchor", {"offsetWidth": "9"})
11+
assert-css: (".impl > a.anchor", {"left": "-8px"})

0 commit comments

Comments
 (0)