Skip to content

Commit 2d52aa0

Browse files
authoredJul 27, 2022
Rollup merge of rust-lang#99812 - GuillaumeGomez:fix-headings-colors, r=jsha,notriddle
Fix headings colors Fixes rust-lang#99797. ![image](https://user-images.githubusercontent.com/3050060/181260966-49faf9d3-f6b8-4de4-bc7d-ed9f0467cf68.png) cc `@jsha` r? `@notriddle`
2 parents c37ee1a + bff43d0 commit 2d52aa0

File tree

5 files changed

+105
-11
lines changed

5 files changed

+105
-11
lines changed
 

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ h2, h3, h4 {
167167
h2,
168168
.top-doc .docblock > h3,
169169
.top-doc .docblock > h4 {
170-
border-bottom: 1px solid;
170+
border-bottom: 1px solid var(--headings-border-bottom-color);
171171
}
172172
h3.code-header {
173173
font-size: 1.125rem; /* 18px */
@@ -652,7 +652,7 @@ h2.location a {
652652
}
653653

654654
.top-doc .docblock h2 { font-size: 1.375rem; }
655-
.top-doc .docblock h3 { font-size: 1.25; }
655+
.top-doc .docblock h3 { font-size: 1.25rem; }
656656
.top-doc .docblock h4,
657657
.top-doc .docblock h5 {
658658
font-size: 1.125rem;

‎src/librustdoc/html/static/css/themes/dark.css

-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ input:focus + .slider {
4242
background-color: #0a042f !important;
4343
}
4444

45-
.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5, .docblock h6 {
46-
border-bottom-color: #DDD;
47-
}
48-
4945
.docblock table td, .docblock table th {
5046
border-color: #ddd;
5147
}

‎src/test/rustdoc-gui/docblock-details.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ reload:
99
assert-text: (".top-doc .docblock > h3", "Hello")
1010
assert-css: (
1111
".top-doc .docblock > h3",
12-
{"border-bottom": "1px solid rgb(221, 221, 221)"},
12+
{"border-bottom": "1px solid rgb(210, 210, 210)"},
1313
)
1414
// We now check that the `<summary>` doesn't have a bottom border and has the correct display.
1515
assert-css: (
1616
".top-doc .docblock summary h4",
17-
{"border-bottom": "0px none rgb(221, 221, 221)"},
17+
{"border-bottom": "0px none rgb(210, 210, 210)"},
1818
)
1919
// This allows to ensure that summary is on one line only!
2020
assert-property: (".top-doc .docblock summary h4", {"offsetHeight": "33"})

‎src/test/rustdoc-gui/headings.goml

+97-3
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,109 @@ assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
150150
assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
151151
assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
152152

153-
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
153+
// Checking colors now.
154154
show-text: true
155155
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
156+
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
157+
assert-css: (
158+
".top-doc .docblock h2",
159+
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
160+
)
161+
assert-css: (
162+
".top-doc .docblock h3",
163+
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
164+
)
165+
assert-css: (
166+
".top-doc .docblock h4",
167+
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
168+
)
169+
assert-css: (
170+
".top-doc .docblock h5",
171+
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
172+
)
173+
assert-css: (
174+
"#implementations-list .docblock h4",
175+
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
176+
)
177+
assert-css: (
178+
"#implementations-list .docblock h5",
179+
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
180+
)
181+
assert-css: (
182+
"#implementations-list .docblock h6",
183+
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
184+
)
185+
186+
local-storage: {"rustdoc-theme": "dark"}
187+
reload:
188+
assert-css: (
189+
".top-doc .docblock h2",
190+
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
191+
)
192+
assert-css: (
193+
".top-doc .docblock h3",
194+
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
195+
)
196+
assert-css: (
197+
".top-doc .docblock h4",
198+
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
199+
)
200+
assert-css: (
201+
".top-doc .docblock h5",
202+
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
203+
)
204+
assert-css: (
205+
"#implementations-list .docblock h4",
206+
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
207+
)
208+
assert-css: (
209+
"#implementations-list .docblock h5",
210+
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
211+
)
212+
assert-css: (
213+
"#implementations-list .docblock h6",
214+
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
215+
)
216+
217+
local-storage: {"rustdoc-theme": "ayu"}
218+
reload:
219+
assert-css: (
220+
".top-doc .docblock h2",
221+
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
222+
)
223+
assert-css: (
224+
".top-doc .docblock h2",
225+
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
226+
)
227+
assert-css: (
228+
".top-doc .docblock h4",
229+
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
230+
)
231+
assert-css: (
232+
".top-doc .docblock h5",
233+
{"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"},
234+
)
235+
assert-css: (
236+
"#implementations-list .docblock h4",
237+
{"color": "rgb(255, 255, 255)", "border-bottom": "0px none rgb(92, 103, 115)"},
238+
)
239+
assert-css: (
240+
"#implementations-list .docblock h5",
241+
{"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"},
242+
)
243+
assert-css: (
244+
"#implementations-list .docblock h6",
245+
{"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"},
246+
)
247+
248+
local-storage: {"rustdoc-theme": "light"}
249+
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
156250
assert-css: (".since", {"color": "rgb(128, 128, 128)"})
157251

158-
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
252+
local-storage: {"rustdoc-theme": "dark"}
159253
reload:
160254
assert-css: (".since", {"color": "rgb(128, 128, 128)"})
161255

162-
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
256+
local-storage: {"rustdoc-theme": "ayu"}
163257
reload:
164258
assert-css: (".since", {"color": "rgb(128, 128, 128)"})

‎src/test/rustdoc-gui/src/test_docs/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ pub use crate::repro as repro2;
146146
/// ### Top-doc Prose sub-sub-heading
147147
///
148148
/// Text below sub-sub-heading
149+
///
150+
/// #### You know the drill.
151+
///
152+
/// More text.
149153
pub struct HeavilyDocumentedStruct {
150154
/// # Title for field
151155
/// ## Sub-heading for field

0 commit comments

Comments
 (0)
Please sign in to comment.