Skip to content

Commit 0bbe2ff

Browse files
Nemo157Joshua Nelson
authored and
Joshua Nelson
committed
Force the navbar to be left-aligned on rustdoc pages
1 parent 05c3aec commit 0bbe2ff

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

src/utils/html.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) fn rewrite_lol(
5555
// Prepend the tera content
5656
rustdoc_body_class.prepend(&tera_body, ContentType::Html);
5757
// Wrap the tranformed body and topbar into a <body> element
58-
rustdoc_body_class.before("<body>", ContentType::Html);
58+
rustdoc_body_class.before(r#"<body class="rustdoc-page">"#, ContentType::Html);
5959
// Insert the topbar outside of the rustdoc div
6060
rustdoc_body_class.before(&tera_rustdoc_topbar, ContentType::Html);
6161
// Finalize body with </body>

templates/style/_rustdoc.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
// FIXME: Use modules
22
@import "vars";
33

4+
// Force the navbar to be left-aligned on rustdoc pages
5+
body.rustdoc-page > .nav-container > .container {
6+
margin-left: 0;
7+
}
8+
9+
div.container-rustdoc {
10+
text-align: left;
11+
}
12+
413
// rustdoc overrides
514
div.rustdoc {
615
font-family: $font-family-serif;
@@ -42,4 +51,8 @@ div.rustdoc {
4251
#sidebar-toggle {
4352
top: 62px;
4453
}
54+
55+
&:focus {
56+
outline: unset;
57+
}
4558
}

templates/style/base.scss

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,6 @@ div.container {
7676
text-align: left;
7777
}
7878

79-
div.container-rustdoc {
80-
text-align: left;
81-
}
82-
83-
div.nav-container-rustdoc {
84-
position: fixed;
85-
left: 0;
86-
right: 0;
87-
top: 0;
88-
z-index: 999;
89-
}
90-
91-
.rustdoc:focus {
92-
outline: unset;
93-
}
94-
9579
div.landing {
9680
text-align: center;
9781
padding-top: 30px;
@@ -564,10 +548,6 @@ div.cratesfyi-package-container {
564548
}
565549
}
566550

567-
div.cratesfyi-package-container-rustdoc {
568-
margin-bottom: 10px;
569-
}
570-
571551
div.search-page-search-form {
572552
padding: 0.4em 1em;
573553
text-align: center;

0 commit comments

Comments
 (0)