Skip to content

Commit

Permalink
Auto merge of rust-lang#91356 - GuillaumeGomez:improve-rustdoc-layout…
Browse files Browse the repository at this point in the history
…, r=jsha

Improve rustdoc layout

This is an overtake of rust-lang#89385 originally written by `@cynecx.`

I kept the original commit and simply added the missing fixes into a new one. You can test it online [here](https://rustdoc.crud.net/imperio/improve-rustdoc-layout/std/index.html).

r? `@jsha`
  • Loading branch information
bors committed Dec 5, 2021
2 parents 772d51f + d7528e2 commit e2116ac
Show file tree
Hide file tree
Showing 29 changed files with 343 additions and 237 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ fn init_id_map() -> FxHashMap<String, usize> {
map.insert("theme-choices".to_owned(), 1);
map.insert("settings-menu".to_owned(), 1);
map.insert("help-button".to_owned(), 1);
map.insert("main".to_owned(), 1);
map.insert("main-content".to_owned(), 1);
map.insert("search".to_owned(), 1);
map.insert("crate-search".to_owned(), 1);
map.insert("render-detail".to_owned(), 1);
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/html/markdown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn test_unique_id() {
"examples",
"method.into_iter",
"foo",
"main",
"main-content",
"search",
"methods",
"examples",
Expand All @@ -28,7 +28,7 @@ fn test_unique_id() {
"examples-2",
"method.into_iter-1",
"foo-1",
"main-1",
"main-content-1",
"search-1",
"methods",
"examples-3",
Expand Down Expand Up @@ -219,8 +219,8 @@ fn test_header_ids_multiple_blocks() {
);
t(
&mut map,
"# Main",
"<h2 id=\"main-1\" class=\"section-header\"><a href=\"#main-1\">Main</a></h2>",
"# Search",
"<h2 id=\"search-1\" class=\"section-header\"><a href=\"#search-1\">Search</a></h2>",
);
t(
&mut map,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/noscript.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ of content is hidden by default (depending on the settings too), we have to over
rules.
*/

#main .attributes {
#main-content .attributes {
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
margin-left: 0 !important;
}
Expand Down
Loading

0 comments on commit e2116ac

Please sign in to comment.