Skip to content

Commit 1e98fb1

Browse files
cynecxGuillaumeGomez
authored andcommitted
rustdoc: fix source view
1 parent 135281e commit 1e98fb1

File tree

2 files changed

+61
-11
lines changed

2 files changed

+61
-11
lines changed

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

+43-4
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,19 @@ main {
261261
overflow-y: auto;
262262
}
263263

264+
.source main {
265+
padding: 15px;
266+
}
267+
264268
.main-inner {
265269
max-width: 960px;
266270
margin-right: auto;
267271
}
268272

273+
.source .main-inner {
274+
max-width: unset;
275+
}
276+
269277
details:not(.rustdoc-toggle) summary {
270278
margin-bottom: .6em;
271279
}
@@ -310,6 +318,7 @@ li {
310318
}
311319

312320
nav.sub {
321+
position: relative;
313322
font-size: 16px;
314323
text-transform: uppercase;
315324
}
@@ -325,6 +334,10 @@ nav.sub {
325334
height: 100vh;
326335
}
327336

337+
.source .sidebar {
338+
display: none;
339+
}
340+
328341
/* Improve the scrollbar display on firefox */
329342
* {
330343
scrollbar-width: initial;
@@ -354,6 +367,18 @@ nav.sub {
354367
display: none !important;
355368
}
356369

370+
.logo-source {
371+
display: none;
372+
}
373+
374+
.source .logo-source {
375+
display: block;
376+
position: absolute;
377+
top: 0;
378+
left: 0;
379+
width: 200px;
380+
}
381+
357382
.logo-container {
358383
height: 100px;
359384
width: 100px;
@@ -716,6 +741,9 @@ nav:not(.sidebar) {
716741
padding-bottom: 10px;
717742
margin-bottom: 25px;
718743
}
744+
.source nav:not(.sidebar).sub {
745+
margin-left: 230px;
746+
}
719747
nav.main {
720748
padding: 20px 0;
721749
text-align: center;
@@ -805,6 +833,7 @@ h2.small-section-header > .anchor {
805833

806834
.search-container {
807835
position: relative;
836+
max-width: 960px;
808837
}
809838
.search-container > div {
810839
display: inline-flex;
@@ -1357,8 +1386,8 @@ pre.rust {
13571386

13581387
.theme-picker {
13591388
position: absolute;
1360-
left: 11px;
1361-
top: 19px;
1389+
left: -34px;
1390+
top: 9px;
13621391
}
13631392

13641393
.theme-picker button {
@@ -1767,10 +1796,18 @@ details.rustdoc-toggle[open] > summary.hideme::after {
17671796
margin-bottom: 10px;
17681797
}
17691798

1799+
.source nav:not(.sidebar).sub {
1800+
margin-left: 32px;
1801+
}
1802+
17701803
.content {
17711804
margin-left: 0px;
17721805
}
17731806

1807+
.source .content {
1808+
margin-top: 10px;
1809+
}
1810+
17741811
#search {
17751812
margin-left: 0;
17761813
padding: 0;
@@ -1781,8 +1818,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
17811818
}
17821819

17831820
.theme-picker {
1784-
left: 10px;
1785-
top: 9px;
17861821
z-index: 1;
17871822
}
17881823

@@ -1909,6 +1944,10 @@ details.rustdoc-toggle[open] > summary.hideme::after {
19091944
.search-results div.desc, .search-results .result-description, .item-right {
19101945
padding-left: 2em;
19111946
}
1947+
1948+
.source .logo-source {
1949+
display: none;
1950+
}
19121951
}
19131952

19141953
@media print {

src/librustdoc/html/templates/page.html

+18-7
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,25 @@
8383
</nav> {#- -#}
8484
<main> {#- -#}
8585
<div class="main-inner"> {#- -#}
86-
<div class="theme-picker"> {#- -#}
87-
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
88-
<img width="18" height="18" alt="Pick another theme!" {# -#}
89-
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
90-
</button> {#- -#}
91-
<div id="theme-choices" role="menu"></div> {#- -#}
92-
</div> {#- -#}
86+
<a class="logo-source" href='{{page.root_path | safe}}{{krate_with_trailing_slash | safe}}index.html'> {#- -#}
87+
<div class='logo-container rust-logo'> {#- -#}
88+
<img src='
89+
{%- if layout.logo -%}
90+
{{layout.logo}}
91+
{%- else -%}
92+
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
93+
{%- endif -%}
94+
' alt='logo'> {#- -#}
95+
</div> {#- -#}
96+
</a> {#- -#}
9397
<nav class="sub"> {#- -#}
98+
<div class="theme-picker"> {#- -#}
99+
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
100+
<img width="18" height="18" alt="Pick another theme!" {# -#}
101+
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
102+
</button> {#- -#}
103+
<div id="theme-choices" role="menu"></div> {#- -#}
104+
</div> {#- -#}
94105
<form class="search-form"> {#- -#}
95106
<div class="search-container"> {#- -#}
96107
<div>{%- if layout.generate_search_filter -%}

0 commit comments

Comments
 (0)