Get syntax highlighting working on GitHub #4341

brson opened this Issue Jan 4, 2013 · 15 comments

5 participants


Pygments has a lexer now.

Related: #1198



What needs to be done for this?


@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?


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.


So it looks like it's actually that needs updated. Linguist already has Rust, though I guess the lexer would need to be changed.


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.


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


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.


Awesome. :)


@strcat mentioned that this needs to be updated to use the rust lexer (not 'text only'): 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.


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

tnm commented Mar 6, 2013

Coming soon!

tnm commented Mar 6, 2013

I just pushed support for Rust on (e.g. ). 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");

@tnm Awesome! Thanks for deploying that so fast.

@brson brson closed this Mar 6, 2013

❤️ ❤️ 💚 💖


This is beautiful. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment