Skip to content

Commit 97578f2

Browse files
Increase impl items indent and decrease documentation indent for impl block
1 parent 583b25d commit 97578f2

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

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

+35-15
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
3636
--button-border-radius: 2px;
3737
--toolbar-button-border-radius: 6px;
3838
--code-block-border-radius: 6px;
39+
--impl-items-indent: 0.5em;
40+
--docblock-indent: 24px;
3941
}
4042

4143
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -909,7 +911,7 @@ both the code example and the line numbers, so we need to remove the radius in t
909911
.docblock h6 { font-size: 0.875rem; }
910912

911913
.docblock {
912-
margin-left: 24px;
914+
margin-left: var(--docblock-indent);
913915
position: relative;
914916
}
915917

@@ -982,7 +984,11 @@ div.where {
982984

983985
.item-info {
984986
display: block;
985-
margin-left: 24px;
987+
margin-left: var(--docblock-indent);
988+
}
989+
.impl-items > .item-info {
990+
/* Margin of docblocks + margin of impl block items. */
991+
margin-left: calc(var(--docblock-indent) + var(--impl-items-indent));
986992
}
987993

988994
.item-info code {
@@ -2166,6 +2172,15 @@ details.toggle > summary:not(.hideme)::before {
21662172
left: -24px;
21672173
}
21682174

2175+
/* We indent items of an impl block to have a visual marker that these items are part
2176+
of this impl block. */
2177+
.impl-items > *:not(.item-info),
2178+
/* We also indent the first top doc comment the same to still keep an indent on the
2179+
doc block while aligning it with the impl block items. */
2180+
.implementors-toggle > .docblock {
2181+
margin-left: var(--impl-items-indent);
2182+
}
2183+
21692184
details.big-toggle > summary:not(.hideme)::before {
21702185
left: -34px;
21712186
top: 9px;
@@ -2255,6 +2270,10 @@ If you update this line, then you also need to update the line with the same war
22552270
in src-script.js and main.js
22562271
*/
22572272
@media (max-width: 700px) {
2273+
:root {
2274+
--impl-items-indent: 0.7em;
2275+
}
2276+
22582277
/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
22592278
or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
22602279
by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
@@ -2454,19 +2473,20 @@ in src-script.js and main.js
24542473
padding-top: 0;
24552474
}
24562475

2457-
/* Position of the "[-]" element. */
2458-
details.toggle:not(.top-doc) > summary, .impl-items > section {
2476+
details.implementors-toggle:not(.top-doc) > summary {
24592477
margin-left: 10px;
24602478
}
2461-
.impl-items > details.toggle > summary:not(.hideme)::before,
2462-
#main-content > details.toggle:not(.top-doc) > summary::before,
2463-
#main-content > div > details.toggle > summary::before {
2464-
left: -11px;
2479+
2480+
.impl-items > details.toggle > summary:not(.hideme)::before {
2481+
left: -20px;
24652482
}
24662483

24672484
/* Align summary-nested and unnested item-info gizmos. */
2485+
.item-info {
2486+
margin-left: 10px;
2487+
}
24682488
.impl-items > .item-info {
2469-
margin-left: 34px;
2489+
margin-left: 28px;
24702490
}
24712491

24722492
.src nav.sub {
@@ -2500,24 +2520,24 @@ in src-script.js and main.js
25002520
}
25012521

25022522
@media print {
2523+
:root {
2524+
--docblock-indent: 0;
2525+
}
2526+
25032527
nav.sidebar, nav.sub, .out-of-band, a.src, #copy-path,
25042528
details.toggle[open] > summary::before, details.toggle > summary::before,
25052529
details.toggle.top-doc > summary {
25062530
display: none;
25072531
}
25082532

2509-
.docblock {
2510-
margin-left: 0;
2511-
}
2512-
25132533
main {
25142534
padding: 10px;
25152535
}
25162536
}
25172537

25182538
@media (max-width: 464px) {
2519-
.docblock {
2520-
margin-left: 12px;
2539+
:root {
2540+
--docblock-indent: 12px;
25212541
}
25222542

25232543
.docblock code {

0 commit comments

Comments
 (0)