Skip to content

Commit 3954e56

Browse files
Fix new sidebar changes
1 parent 1dd2aee commit 3954e56

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

src/utils/rustc_version.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ fn parse_rustc_date<S: AsRef<str>>(version: S) -> Result<Date<Utc>> {
4343
/// generate this version of this crate.
4444
pub fn get_correct_docsrs_style_file(version: &str) -> Result<String> {
4545
let date = parse_rustc_date(version)?;
46+
// This is the date where https://github.com/rust-lang/rust/pull/92692 was merged.
47+
if Utc.ymd(2022, 1, 19) < date {
48+
Ok("rustdoc-2022-01-19.css".to_owned())
49+
}
4650
// This is the date where https://github.com/rust-lang/rust/pull/91356 was merged.
47-
if Utc.ymd(2021, 12, 5) < date {
51+
else if Utc.ymd(2021, 12, 5) < date {
4852
// If this is the new rustdoc layout, we need the newer docs.rs CSS file.
4953
Ok("rustdoc-2021-12-05.css".to_owned())
5054
} else {
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// FIXME: Use modules
2+
@import "rustdoc-common";
3+
4+
// This file is needed to overload the previous docs.rs style. It is added into crates generated
5+
// using rustdoc after https://github.com/rust-lang/rust/pull/92692 has been merged.
6+
7+
#rustdoc_body_wrapper {
8+
padding: 0;
9+
10+
.sidebar {
11+
margin-top: 0;
12+
top: $top-navbar-height;
13+
height: calc(100vh - $top-navbar-height);
14+
/* Since we use `overflow-wrap: anywhere;`, we never have the need for a X scrollbar... */
15+
overflow-x: hidden;
16+
17+
.sidebar-menu {
18+
top: $top-navbar-height;
19+
}
20+
}
21+
22+
main {
23+
padding-bottom: 50px;
24+
}
25+
}
26+
27+
div.container-rustdoc {
28+
> .docs-rs-footer {
29+
bottom: 0;
30+
right: 0;
31+
}
32+
}
33+
34+
div.container-rustdoc:not(.source) {
35+
> .docs-rs-footer {
36+
left: 200px;
37+
}
38+
}
39+
40+
div.rustdoc {
41+
#sidebar-toggle {
42+
top: 0;
43+
}
44+
}

0 commit comments

Comments
 (0)