GitHub 使用什么 JavaScript 语法荧光笔?
当您单击文件名时,GitHub 在其网站上使用什么语法荧光笔来显示代码?
What syntax highlighter is GitHub using on their site to display the code when you click on the file names?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为此帮助页面 GitHub.com 表示,他们正在使用 Linguist 库,它是用 Ruby 编写的。
Linguist 每种语言的荧光笔位于
vendor/grammars
< /a>.可以找到支持的语言列表 此处,此处和此处。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.GitHub 使用 tree-sitter 语法来突出显示以下语言的语法:CSS、Go、 JavaScript、EJS、ERB、HTML、Python、Ruby、TypeScript 和 CodeQL。 JavaScript tree-sitter 语法在这里: https://github.com/tree-sitter /tree-sitter-javascript (语法.js 和src/scanner.c 是重要文件)
来源:https://github.com/github/linguist/discussions/5572#discussioncomment-1355712
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