-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add version switcher #58603
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
Add version switcher #58603
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#jump-version { | ||
position: fixed; | ||
right: 5px; | ||
bottom: 5px; | ||
border: 1px solid #ccc; | ||
border-radius: 3px; | ||
background-color: #eee; | ||
color: #000; | ||
padding: 4px; | ||
font-size: 1.1em; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(function(){ | ||
var VERSIONS = []; | ||
if (window.location.protocol === "file:" || window.location.host !== "doc.rust-lang.org") { | ||
return; | ||
} | ||
var version = window.location.pathname.split("/").filter(function(x) { | ||
return x.length > 0; | ||
})[0]; | ||
if (version === "std") { | ||
version = "stable"; | ||
} | ||
var s = document.createElement("select"); | ||
for (var i = 0; i < VERSIONS.length; ++i) { | ||
var entry = document.createElement("option"); | ||
entry.innerText = VERSIONS[i]; | ||
entry.value = VERSIONS[i]; | ||
if (VERSIONS[i] === version) { | ||
entry.selected = true; | ||
} | ||
s.append(entry); | ||
} | ||
s.id = "jump-version"; | ||
s.onchange = function() { | ||
var parts = window.location.pathname.split("/").filter(function(x) { | ||
return x.length > 0; | ||
}); | ||
if (parts[0] !== "std") { | ||
parts.shift(); | ||
} | ||
window.location.pathname = this.value + "/" + parts.join("/"); | ||
}; | ||
document.body.appendChild(s); | ||
}()); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,18 @@ fn opts() -> Vec<RustcOptGroup> { | |
Markdown file or generated documentation", | ||
"FILES") | ||
}), | ||
unstable("raw-js-in-header", |o| { | ||
o.optopt("", "raw-js-in-header", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bikeshed warning: Since the included file eventually gets named I also feel like the flag description is a little misleading. Maybe something like:
(I feel like this feature would be much better served if it allowed multiple files, but that can be added in a separate PR. Since the flag will be unstable, we can edit it after it lands.) |
||
"JS to include in the <head> section of a rendered Markdown file \ | ||
or generated documentation", | ||
"text") | ||
}), | ||
unstable("raw-css-in-header", |o| { | ||
o.optopt("", "raw-css-in-header", | ||
"CSS to include in the <head> section of a rendered Markdown file \ | ||
or generated documentation", | ||
"text") | ||
}), | ||
unstable("markdown-before-content", |o| { | ||
o.optmulti("", "markdown-before-content", | ||
"files to include inline between <body> and the content of a rendered \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be cool if we could also add bugfix releases in here, but that might be hard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bugfixes don't change API normally so I'm not sure it's really useful to add them in here.