Skip to content

Commit cbcf8d4

Browse files
Rollup merge of #78103 - GuillaumeGomez:rustdoc-book, r=jyn514
Add link to rustdoc book in rustdoc help popup Part of #75520. It looks like this: ![Screenshot from 2020-10-19 13-46-02](https://user-images.githubusercontent.com/3050060/96446334-934d6900-1211-11eb-8fdc-133fecc8c30d.png) ![Screenshot from 2020-10-19 13-43-46](https://user-images.githubusercontent.com/3050060/96446335-947e9600-1211-11eb-955c-68af5292aecc.png) ![Screenshot from 2020-10-19 13-37-26](https://user-images.githubusercontent.com/3050060/96446337-947e9600-1211-11eb-9a2e-399b99178a65.png) r? @jyn514
2 parents 81180f4 + 880d644 commit cbcf8d4

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

src/librustdoc/html/static/main.js

+5
Original file line numberDiff line numberDiff line change
@@ -2792,6 +2792,10 @@ function defocusSearchBar() {
27922792
addClass(popup, "hidden");
27932793
popup.id = "help";
27942794

2795+
var book_info = document.createElement("span");
2796+
book_info.innerHTML = "You can find more information in \
2797+
<a href=\"https://doc.rust-lang.org/rustdoc/\">the rustdoc book</a>.";
2798+
27952799
var container = document.createElement("div");
27962800
var shortcuts = [
27972801
["?", "Show this help dialog"],
@@ -2825,6 +2829,7 @@ function defocusSearchBar() {
28252829
addClass(div_infos, "infos");
28262830
div_infos.innerHTML = "<h2>Search Tricks</h2>" + infos;
28272831

2832+
container.appendChild(book_info);
28282833
container.appendChild(div_shortcuts);
28292834
container.appendChild(div_infos);
28302835

src/librustdoc/html/static/rustdoc.css

+10-2
Original file line numberDiff line numberDiff line change
@@ -796,14 +796,22 @@ body.blur > :not(#help) {
796796
clear: left;
797797
display: block;
798798
}
799+
#help > div > span {
800+
text-align: center;
801+
display: block;
802+
margin: 10px 0;
803+
font-size: 18px;
804+
border-bottom: 1px solid #ccc;
805+
padding-bottom: 4px;
806+
margin-bottom: 6px;
807+
}
799808
#help dd { margin: 5px 35px; }
800809
#help .infos { padding-left: 0; }
801810
#help h1, #help h2 { margin-top: 0; }
802811
#help > div div {
803812
width: 50%;
804813
float: left;
805-
padding: 20px;
806-
padding-left: 17px;
814+
padding: 0 20px 20px 17px;;
807815
}
808816

809817
.stab {

src/librustdoc/html/static/themes/ayu.css

+6-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ a {
219219
}
220220

221221
.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
222-
.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
222+
.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
223+
#help a {
223224
color: #39AFD7;
224225
}
225226

@@ -275,6 +276,10 @@ a {
275276
border-radius: 4px;
276277
}
277278

279+
#help > div > span {
280+
border-bottom-color: #5c6773;
281+
}
282+
278283
.since {
279284
color: grey;
280285
}

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ a {
177177
}
178178

179179
.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
180-
.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
180+
.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
181+
#help a {
181182
color: #D2991D;
182183
}
183184

@@ -231,6 +232,10 @@ a.test-arrow {
231232
border-color: #bfbfbf;
232233
}
233234

235+
#help > div > span {
236+
border-bottom-color: #bfbfbf;
237+
}
238+
234239
#help dt {
235240
border-color: #bfbfbf;
236241
background: rgba(0,0,0,0);

src/librustdoc/html/static/themes/light.css

+6-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ a {
175175
}
176176

177177
.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
178-
.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
178+
.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
179+
#help a {
179180
color: #3873AD;
180181
}
181182

@@ -229,6 +230,10 @@ a.test-arrow {
229230
border-color: #bfbfbf;
230231
}
231232

233+
#help > div > span {
234+
border-bottom-color: #bfbfbf;
235+
}
236+
232237
.since {
233238
color: grey;
234239
}

0 commit comments

Comments
 (0)