Skip to content

Get syntax highlighting working on GitHub #4341

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

Closed
brson opened this issue Jan 4, 2013 · 15 comments
Closed

Get syntax highlighting working on GitHub #4341

brson opened this issue Jan 4, 2013 · 15 comments
Milestone

Comments

@brson
Copy link
Contributor

brson commented Jan 4, 2013

Pygments has a lexer now.

Related: #1198

@steveklabnik
Copy link
Member

🤘

What needs to be done for this?

@brson
Copy link
Contributor Author

brson commented Jan 4, 2013

@steveklabnik Support needs to be added to linguist, and GitHub needs to update pygments to something newer than this commit.

I do not know the process for getting GitHub to do the pygments upgrade, but I imagine mentioning it prominently in the linguest pull request would be a start.

Are you interested in updating linguist?

@steveklabnik
Copy link
Member

I am interested but I've never done it before, so I can't guarantee that I'll be successful. Let me see what I can do.

@steveklabnik
Copy link
Member

So it looks like it's actually https://github.com/tmm1/pygments.rb that needs updated. Linguist already has Rust, though I guess the lexer would need to be changed.

@lomereiter
Copy link

AFAIU pygments.rb just talks to Python via a pipe, getting list of lexers at the start, so there's nothing to update there.

Changing lexer to rust should be enough. Maybe it's a good idea to also throw in a few samples for bayesian classifier, although I doubt that .rs extension is used in any other language.

@brson
Copy link
Contributor Author

brson commented Mar 5, 2013

So I'm not clear at all on what needs to be done now to make this happen. Does anybody? I think we probably need to do the following:

  1. Update pygments again - the last patch was done very long ago
  2. ?
  3. Ask GitHub to upgrade pygments

@brson
Copy link
Contributor Author

brson commented Mar 5, 2013

OK, after asking on IRC this is my understanding.

  • The released version of pygments 1.6 contains a very old definition of Rust
  • GitHub is using 1.5 currently. @uvtc emailed GitHub to ask about this and they say they will hopefully upgrade to 1.6 soon
  • Patrick recently updated pygments, presumably will be in 1.7
  • Linguist already supports rust
  • pygments.rb doesn't need explicit support

I think there is nothing left to do but wait for GitHub to upgrade pygments (or bug them to do so). At that point GitHub will support an ancient version of Rust. Then we continue waiting for them to upgrade to the next release, at which point we'll be like a year out of date again. Not a great situation, but as Rust stabilizes, presumably GitHub and Rust will, over the course of years, converge on the correct grammar.

@steveklabnik
Copy link
Member

Awesome. :)

@brson
Copy link
Contributor Author

brson commented Mar 5, 2013

@strcat mentioned that this needs to be updated to use the rust lexer (not 'text only'): https://github.com/github/linguist/blob/master/lib/linguist/languages.yml#L1098. Presumably this needs to be done after they upgrade pygments to 1.6, and there is some evidence that they've already done this since gists do use syntax highlighting when told to use 'rust' explicitly.

@brson
Copy link
Contributor Author

brson commented Mar 6, 2013

I submitted a pull request to linquist to turn on the Rust lexer.

@tnm
Copy link

tnm commented Mar 6, 2013

Coming soon!

@tnm
Copy link

tnm commented Mar 6, 2013

I just pushed support for Rust on github.com (e.g. https://github.com/mozilla/rust/blob/master/src/libsyntax/attr.rs ). Enjoy!

Screen Shot 2013-03-06 at 3 12 02 PM

Screen Shot 2013-03-06 at 3 04 54 PM

return match we_have_rust {
    let yes = yep::word(1,2,3);
    data("R U S T");
}

@brson
Copy link
Contributor Author

brson commented Mar 6, 2013

@tnm Awesome! Thanks for deploying that so fast.

@brson brson closed this as completed Mar 6, 2013
@steveklabnik
Copy link
Member

❤️ ❤️ 💚 💖

@ejholmes
Copy link
Contributor

ejholmes commented Mar 6, 2013

This is beautiful. ❤️

RalfJung added a commit to RalfJung/rust that referenced this issue May 22, 2025
run the full test suite under FreeBSD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants