Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What JavaScript syntax highlighter does GitHub use?

What syntax highlighter is GitHub using on their site to display the code when you click on the file names?

like image 323
thiesdiggity Avatar asked Jan 16 '12 21:01

thiesdiggity


People also ask

What syntax highlighter does Github use?

We use Linguist to perform language detection and to select third-party grammars for syntax highlighting.

Does Github use highlight JS?

It doesn't do syntax highlighting, it only detects the language, I explored the repository alot. The grammars specify the text-mate scopes, which are not used by the linguist.

What is syntax highlighting in JavaScript?

Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords like if or for in JavaScript differently than strings and comments and variable names.

How do I highlight text in github?

You can also create a Markdown hyperlink by highlighting the text and using the keyboard shortcut Command + V . If you'd like to replace the text with the link, use the keyboard shortcut Command + Shift + V .


1 Answers

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

Source: https://github.com/github/linguist/discussions/5572#discussioncomment-1355712

like image 177
Boris Avatar answered Oct 16 '22 17:10

Boris