Skip to content

Commit f750450

Browse files
Increase impl items indent and decrease documentation indent for impl block
1 parent 9322d18 commit f750450

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

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

+27-9
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. */
@@ -908,7 +910,7 @@ both the code example and the line numbers, so we need to remove the radius in t
908910
.docblock h6 { font-size: 0.875rem; }
909911

910912
.docblock {
911-
margin-left: 24px;
913+
margin-left: var(--docblock-indent);
912914
position: relative;
913915
}
914916

@@ -981,7 +983,11 @@ div.where {
981983

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

987993
.item-info code {
@@ -2154,6 +2160,15 @@ details.toggle > summary:not(.hideme)::before {
21542160
left: -24px;
21552161
}
21562162

2163+
/* We indent items of an impl block to have a visual marker that these items are part
2164+
of this impl block. */
2165+
.impl-items > *:not(.item-info),
2166+
/* We also indent the first top doc comment the same to still keep an indent on the
2167+
doc block while aligning it with the impl block items. */
2168+
.implementors-toggle > .docblock {
2169+
margin-left: var(--impl-items-indent);
2170+
}
2171+
21572172
details.big-toggle > summary:not(.hideme)::before {
21582173
left: -34px;
21592174
top: 9px;
@@ -2448,8 +2463,11 @@ in src-script.js and main.js
24482463
}
24492464

24502465
/* Align summary-nested and unnested item-info gizmos. */
2466+
.item-info {
2467+
margin-left: 10px;
2468+
}
24512469
.impl-items > .item-info {
2452-
margin-left: 34px;
2470+
margin-left: 28px;
24532471
}
24542472

24552473
.src nav.sub {
@@ -2483,24 +2501,24 @@ in src-script.js and main.js
24832501
}
24842502

24852503
@media print {
2504+
:root {
2505+
--docblock-indent: 0;
2506+
}
2507+
24862508
nav.sidebar, nav.sub, .out-of-band, a.src, #copy-path,
24872509
details.toggle[open] > summary::before, details.toggle > summary::before,
24882510
details.toggle.top-doc > summary {
24892511
display: none;
24902512
}
24912513

2492-
.docblock {
2493-
margin-left: 0;
2494-
}
2495-
24962514
main {
24972515
padding: 10px;
24982516
}
24992517
}
25002518

25012519
@media (max-width: 464px) {
2502-
.docblock {
2503-
margin-left: 12px;
2520+
:root {
2521+
--docblock-indent: 12px;
25042522
}
25052523

25062524
.docblock code {

0 commit comments

Comments
 (0)