Skip to content

Commit 1425235

Browse files
committed
rustdoc: improve alignment of out-of-band page info
1 parent e930ab3 commit 1425235

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ h1, h2, h3, h4 {
138138
margin-top: 0;
139139
}
140140
.main-heading h1 {
141-
margin: 9px 0 0 0;
141+
margin: 0;
142142
padding: 0;
143143
flex-grow: 1;
144144
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
@@ -151,7 +151,7 @@ h1, h2, h3, h4 {
151151
.main-heading {
152152
display: flex;
153153
flex-wrap: wrap;
154-
padding-bottom: 6px;
154+
padding: 9px 0 6px 0;
155155
margin-bottom: 15px;
156156
}
157157
/* The only headings that get underlines are:
@@ -577,6 +577,11 @@ ul.block, .block li {
577577
margin-bottom: 1rem;
578578
}
579579

580+
.version {
581+
/* same font style used in `.since` */
582+
font-variant-numeric: oldstyle-nums;
583+
}
584+
580585
.mobile-topbar {
581586
display: none;
582587
}
@@ -668,7 +673,10 @@ ul.block, .block li {
668673

669674
.out-of-band {
670675
flex-grow: 0;
671-
font-size: 1.125rem;
676+
font-size: 1.25rem;
677+
align-items: center;
678+
display: flex;
679+
gap: 0.25em;
672680
}
673681

674682
.docblock code, .docblock-short code,
@@ -1120,6 +1128,8 @@ so that we can apply CSS-filters to change the arrow color in themes */
11201128
.since {
11211129
font-weight: normal;
11221130
font-size: initial;
1131+
/* align with the word "source" in all lowercase */
1132+
font-variant-numeric: oldstyle-nums;
11231133
}
11241134

11251135
.rightside {
@@ -1596,7 +1606,7 @@ details.toggle > summary::before {
15961606
/* toggle plus */
15971607
background: url('data:image/svg+xml,<svg width="19" height="19" stroke="black" fill="none" \
15981608
xmlns="http://www.w3.org/2000/svg"><path d="M2.5 2.5h14v14h-14v-14.5" \
1599-
shape-rendering="crispEdges"/><path d="M6 9.5h7M9.5 13.5V5.5"/></svg>') no-repeat top left;
1609+
shape-rendering="crispEdges" stroke="grey"/><path d="M6 9.5h7M9.5 13.5V5.5"/></svg>') no-repeat top left;
16001610
content: "";
16011611
cursor: pointer;
16021612
width: 18px;
@@ -1675,9 +1685,8 @@ details.toggle[open] > summary.hideme > span {
16751685

16761686
details.toggle[open] > summary::before {
16771687
/* toggle minus */
1678-
background: url('data:image/svg+xml,<svg width="19" height="19" \
1679-
shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \
1680-
d="M2.5 2.5h14v14h-14v-14.5"/><path d="M6 9.5h7"/></svg>') no-repeat top left;
1688+
background: url('data:image/svg+xml,<svg width="15" height="15" stroke="black" fill="none" \
1689+
xmlns="http://www.w3.org/2000/svg"><path d="M3 6.5h7"/></svg>') no-repeat top left;
16811690
}
16821691

16831692
details.toggle[open] > summary::after {
@@ -1743,6 +1752,7 @@ in src-script.js
17431752
text-align: left;
17441753
margin-left: initial;
17451754
padding: initial;
1755+
display: block;
17461756
}
17471757

17481758
.out-of-band .since::before {

tests/rustdoc-gui/scrape-examples-layout.goml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ assert-position: (".scraped-example .code-wrapper .prev", {"y": 226 + |offset_y|
4444

4545
// Then with mobile
4646
set-window-size: (600, 600)
47-
assert-position: (".scraped-example .code-wrapper", {"y": 308})
48-
assert-position: (".scraped-example .code-wrapper .prev", {"y": 308 + |offset_y|})
47+
assert-position: (".scraped-example .code-wrapper", {"y": 311})
48+
assert-position: (".scraped-example .code-wrapper .prev", {"y": 311 + |offset_y|})

0 commit comments

Comments
 (0)