Reputation: 1967
What syntax highlighter is GitHub using on their site to display the code when you click on the file names?
Upvotes: 21
Views: 6133
Reputation:
GitHub uses tree-sitter grammars for syntax highlighting the following languages: CSS, Go, JavaScript, EJS, ERB, HTML, Python, Ruby, TypeScript and CodeQL. The JavaScript tree-sitter grammar is here: https://github.com/tree-sitter/tree-sitter-javascript (grammar.js and src/scanner.c are the important files)
Source: https://github.com/github/linguist/discussions/5572#discussioncomment-1355712
Upvotes: 4
Reputation: 9445
As this help page of GitHub.com says, they’re using the Linguist library, which is written in Ruby.
Linguist’s highlighters for each language are within vendor/grammars
. And a list of supported languages can be found here, here, and here.
Upvotes: 9