Skip to content

Commit b3c08a3

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

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

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

+12-5
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:
@@ -668,7 +668,10 @@ ul.block, .block li {
668668

669669
.out-of-band {
670670
flex-grow: 0;
671-
font-size: 1.125rem;
671+
font-size: 1.25rem;
672+
align-items: center;
673+
display: flex;
674+
gap: 0.25em;
672675
}
673676

674677
.docblock code, .docblock-short code,
@@ -1120,6 +1123,8 @@ so that we can apply CSS-filters to change the arrow color in themes */
11201123
.since {
11211124
font-weight: normal;
11221125
font-size: initial;
1126+
/* align with the word "source" in all lowercase */
1127+
font-variant-numeric: oldstyle-nums;
11231128
}
11241129

11251130
.rightside {
@@ -1596,7 +1601,7 @@ details.toggle > summary::before {
15961601
/* toggle plus */
15971602
background: url('data:image/svg+xml,<svg width="19" height="19" stroke="black" fill="none" \
15981603
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;
1604+
shape-rendering="crispEdges" stroke="grey"/><path d="M6 9.5h7M9.5 13.5V5.5"/></svg>') no-repeat top left;
16001605
content: "";
16011606
cursor: pointer;
16021607
width: 18px;
@@ -1677,7 +1682,7 @@ details.toggle[open] > summary::before {
16771682
/* toggle minus */
16781683
background: url('data:image/svg+xml,<svg width="19" height="19" \
16791684
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+
d="M2.5 2.5h14v14h-14v-14.5" stroke="grey"/><path d="M6 9.5h7"/></svg>') no-repeat top left;
16811686
}
16821687

16831688
details.toggle[open] > summary::after {
@@ -1743,10 +1748,12 @@ in src-script.js
17431748
text-align: left;
17441749
margin-left: initial;
17451750
padding: initial;
1751+
display: block;
17461752
}
17471753

17481754
.out-of-band .since::before {
17491755
content: "Since ";
1756+
font-variant-numeric: normal;
17501757
}
17511758

17521759
/* Hide the logo and item name from the sidebar. Those are displayed

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)