Skip to content

Add link to rustdoc book in rustdoc help popup #78103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2792,6 +2792,10 @@ function defocusSearchBar() {
addClass(popup, "hidden");
popup.id = "help";

var book_info = document.createElement("span");
book_info.innerHTML = "You can find more information in \
<a href=\"https://doc.rust-lang.org/rustdoc/\">the rustdoc book</a>.";

var container = document.createElement("div");
var shortcuts = [
["?", "Show this help dialog"],
Expand Down Expand Up @@ -2825,6 +2829,7 @@ function defocusSearchBar() {
addClass(div_infos, "infos");
div_infos.innerHTML = "<h2>Search Tricks</h2>" + infos;

container.appendChild(book_info);
container.appendChild(div_shortcuts);
container.appendChild(div_infos);

Expand Down
12 changes: 10 additions & 2 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -796,14 +796,22 @@ body.blur > :not(#help) {
clear: left;
display: block;
}
#help > div > span {
text-align: center;
display: block;
margin: 10px 0;
font-size: 18px;
border-bottom: 1px solid #ccc;
padding-bottom: 4px;
margin-bottom: 6px;
}
#help dd { margin: 5px 35px; }
#help .infos { padding-left: 0; }
#help h1, #help h2 { margin-top: 0; }
#help > div div {
width: 50%;
float: left;
padding: 20px;
padding-left: 17px;
padding: 0 20px 20px 17px;;
}

.stab {
Expand Down
7 changes: 6 additions & 1 deletion src/librustdoc/html/static/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ a {
}

.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
#help a {
color: #39AFD7;
}

Expand Down Expand Up @@ -275,6 +276,10 @@ a {
border-radius: 4px;
}

#help > div > span {
border-bottom-color: #5c6773;
}

.since {
color: grey;
}
Expand Down
7 changes: 6 additions & 1 deletion src/librustdoc/html/static/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ a {
}

.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
#help a {
color: #D2991D;
}

Expand Down Expand Up @@ -231,6 +232,10 @@ a.test-arrow {
border-color: #bfbfbf;
}

#help > div > span {
border-bottom-color: #bfbfbf;
}

#help dt {
border-color: #bfbfbf;
background: rgba(0,0,0,0);
Expand Down
7 changes: 6 additions & 1 deletion src/librustdoc/html/static/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ a {
}

.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
.docblock-short a:not(.srclink):not(.test-arrow), .stability a,
#help a {
color: #3873AD;
}

Expand Down Expand Up @@ -229,6 +230,10 @@ a.test-arrow {
border-color: #bfbfbf;
}

#help > div > span {
border-bottom-color: #bfbfbf;
}

.since {
color: grey;
}
Expand Down