-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: Add syntax highlighting #12416
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
Preview: http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/index.html I just picked the color scheme out of my terminal, no attachment to it! |
loop { | ||
let next = lexer.next_token(); | ||
let test = if next.tok == t::EOF {lexer.pos.get()} else {next.sp.lo}; | ||
if test > last { |
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 is testing if there's a gap between two tokens, and then checking if that gap contains a comment, right?
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.
(Could you add a comment?)
Pushed with comments addressed. |
@@ -1231,7 +1232,7 @@ fn render_method(w: &mut Writer, meth: &clean::Item) -> fmt::Result { | |||
|
|||
fn item_struct(w: &mut Writer, it: &clean::Item, | |||
s: &clean::Struct) -> fmt::Result { | |||
try!(write!(w, "<pre class='struct'>")); | |||
try!(write!(w, "<pre class='rtry struct'>")); |
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.
Something got mangled?
r=me with comments addressed. |
This is awesome. The colors suck, but that's an easy fix for later. |
I like my terminal's colors :( That's also why I'd never get hired as a designer! |
This adds simple syntax highlighting based off libsyntax's lexer to be sure to stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc, but it definitely seems to get the job done! This currently doesn't highlight rustdoc-rendered function signatures and structs that are emitted to each page because the colors already signify what's clickable and I think we'd have to figure out a different scheme before colorizing them. This does, however, colorize all code examples and source code. Closes rust-lang#11393
This adds simple syntax highlighting based off libsyntax's lexer to be sure to stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc, but it definitely seems to get the job done! This currently doesn't highlight rustdoc-rendered function signatures and structs that are emitted to each page because the colors already signify what's clickable and I think we'd have to figure out a different scheme before colorizing them. This does, however, colorize all code examples and source code. Closes #11393
Add implicit static lifetime hints
Add missing header for `manual_is_variant_and` Noticed this while generating our lint completions failed in rust-analyzer (separate PR from rust-lang/rust-clippy#12415 as I made these via the github interface quickly) changelog: none
This adds simple syntax highlighting based off libsyntax's lexer to be sure to
stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc,
but it definitely seems to get the job done!
This currently doesn't highlight rustdoc-rendered function signatures and
structs that are emitted to each page because the colors already signify what's
clickable and I think we'd have to figure out a different scheme before
colorizing them. This does, however, colorize all code examples and source code.
Closes #11393