Skip to content

Commit 4efacce

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

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

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

+14-7
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:
@@ -570,6 +570,8 @@ ul.block, .block li {
570570
overflow-wrap: break-word;
571571
/* opposite of the link padding, cut in half again */
572572
margin-top: calc( ( -16px + 0.57rem ) / 2 );
573+
/* same font style used in `.since` */
574+
font-variant-numeric: oldstyle-nums;
573575
}
574576

575577
.sidebar-crate + .version {
@@ -668,7 +670,10 @@ ul.block, .block li {
668670

669671
.out-of-band {
670672
flex-grow: 0;
671-
font-size: 1.125rem;
673+
font-size: 1.25rem;
674+
align-items: center;
675+
display: flex;
676+
gap: 0.25em;
672677
}
673678

674679
.docblock code, .docblock-short code,
@@ -1120,6 +1125,8 @@ so that we can apply CSS-filters to change the arrow color in themes */
11201125
.since {
11211126
font-weight: normal;
11221127
font-size: initial;
1128+
/* align with the word "source" in all lowercase */
1129+
font-variant-numeric: oldstyle-nums;
11231130
}
11241131

11251132
.rightside {
@@ -1596,7 +1603,7 @@ details.toggle > summary::before {
15961603
/* toggle plus */
15971604
background: url('data:image/svg+xml,<svg width="19" height="19" stroke="black" fill="none" \
15981605
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;
1606+
shape-rendering="crispEdges" stroke="grey"/><path d="M6 9.5h7M9.5 13.5V5.5"/></svg>') no-repeat top left;
16001607
content: "";
16011608
cursor: pointer;
16021609
width: 18px;
@@ -1675,9 +1682,8 @@ details.toggle[open] > summary.hideme > span {
16751682

16761683
details.toggle[open] > summary::before {
16771684
/* 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;
1685+
background: url('data:image/svg+xml,<svg width="15" height="15" stroke="black" fill="none" \
1686+
xmlns="http://www.w3.org/2000/svg"><path d="M3 6.5h7"/></svg>') no-repeat top left;
16811687
}
16821688

16831689
details.toggle[open] > summary::after {
@@ -1743,6 +1749,7 @@ in src-script.js
17431749
text-align: left;
17441750
margin-left: initial;
17451751
padding: initial;
1752+
display: block;
17461753
}
17471754

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

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

+2-2
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)