-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make the line numbers of the source code clickable #20092
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
Conversation
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
76c1437
to
9dc1e1c
Compare
@@ -17,7 +17,7 @@ Some examples that demonstrate different aspects of the language: | |||
* [sprocketnes], an NES emulator with no GC, using modern Rust conventions | |||
* The language's general-purpose [hash] function, SipHash-2-4. Bit twiddling, OO, macros | |||
* The standard library's [HashMap], a sendable hash map in an OO style | |||
* The extra library's [json] module. Enums and pattern matching | |||
* The standard library's [json] module. Enums and pattern matching |
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.
This change, while good, is totally unrelated
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.
I was in worry of opening another PR to handle such a minor change. (It felt like spamming.) May I open a new one anyways?
Our actual highlighting script supports ranges: http://doc.rust-lang.org/src/core/slice.rs.html#456-470, which Github's UI supports through shift-clicking line numbers. Possible? |
9dc1e1c
to
2169702
Compare
@gankro Challenge accepted. I've pushed a new implementation. Currently running tests. |
6374597
to
5bce14b
Compare
This is cool! Would it be possible to publish an example somewhere so we can experiment? (If you don't have an alternative, you can use github pages: e.g. commit a generated copy to a |
Awesome! Could you also put the new JS wad into |
01ea47e
to
a5617b6
Compare
@huonw I've uploaded them to https://barosl.com/tmp/rust/doc/src/std/lib.rs.html @alexcrichton Oops, sorry. I should have considered that. It is fixed now. |
I've changed a bit more, using the HTML5 history API(pushState) if the browser supports it. This prevents the page from being scrolled. Also, I also removed the unused |
a5617b6
to
9bf309a
Compare
@@ -464,8 +473,6 @@ h1 .stability { | |||
.summary.Stable { background-color: #54A759; } | |||
.summary.Unmarked { background-color: #BBBBBB; } | |||
|
|||
:target { background: #FDFFD3; } |
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.
I think this CSS rule was also used for clicking on headers in documentation. That may be covered elsewhere, but can you make sure that if you click on a header that it still gets highlighted?
9bf309a
to
87d4444
Compare
extra library -> standard library
87d4444
to
739f74b
Compare
While talking on IRC, someone wanted to post a link to the Rust source code, but while the lines of the rendered source code do have anchors (`<span id="[line number]">`), there is no convenient way to make links as they are not clickable. This PR makes them clickable. Also, a minor fix of the FAQ is included.
While talking on IRC, someone wanted to post a link to the Rust source code, but while the lines of the rendered source code do have anchors (`<span id="[line number]">`), there is no convenient way to make links as they are not clickable. This PR makes them clickable. Also, a minor fix of the FAQ is included.
Due to the CSS changes done by the previous patch to make the line numbers clickable (rust-lang#20092), the sidebar became unclickable. This commit reverts the changes and adopts an alternative approach.
Due to the CSS changes done by the previous patch to make the line numbers clickable (rust-lang#20092), the sidebar became unclickable. This PR reverts the changes and adopts an alternative approach. I'm very sorry for having broken things.
While talking on IRC, someone wanted to post a link to the Rust source code, but while the lines of the rendered source code do have anchors (
<span id="[line number]">
), there is no convenient way to make links as they are not clickable. This PR makes them clickable.Also, a minor fix of the FAQ is included.