Skip to content

Get syntax highlighting working on GitHub #4341

Description

@brson

Pygments has a lexer now.

Related: #1198

Activity

  1. steveklabnik commented on Jan 4, 2013

    @steveklabnik
    Contributor

    🤘

    What needs to be done for this?

  2. brson commented on Jan 4, 2013

    @brson
    ContributorAuthor

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

  3. steveklabnik commented on Jan 4, 2013

    @steveklabnik
    Contributor

    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.

  4. steveklabnik commented on Jan 4, 2013

    @steveklabnik
    Contributor

    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.

  5. lomereiter commented on Jan 9, 2013

    @lomereiter

    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.

  6. brson commented on Mar 5, 2013

    @brson
    ContributorAuthor

    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
  7. brson commented on Mar 5, 2013

    @brson
    ContributorAuthor

    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.

  8. steveklabnik commented on Mar 5, 2013

    @steveklabnik
    Contributor

    Awesome. :)

  9. brson commented on Mar 5, 2013

    @brson
    ContributorAuthor

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

  10. brson commented on Mar 6, 2013

    @brson
    ContributorAuthor

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

  11. tnm commented on Mar 6, 2013

    @tnm

    Coming soon!

  12. tnm commented on Mar 6, 2013

    @tnm

    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");
    }
  13. brson commented on Mar 6, 2013

    @brson
    ContributorAuthor

    @tnm Awesome! Thanks for deploying that so fast.

  14. steveklabnik commented on Mar 6, 2013

    @steveklabnik
    Contributor

    ❤️ ❤️ 💚 💖

  15. ejholmes commented on Mar 6, 2013

    @ejholmes
    Contributor

    This is beautiful. ❤️

  16. added a commit that references this issue on May 22, 2025
  17. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions