🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# Syntax Highlighting > 原文:[https://docs.gitlab.com/ee/user/project/highlighting.html](https://docs.gitlab.com/ee/user/project/highlighting.html) # Syntax Highlighting[](#syntax-highlighting "Permalink") GitLab 通过[Rouge](https://rubygems.org/gems/rouge) Ruby gem 在所有文件上提供语法高亮显示. 它将尝试根据文件扩展名猜测要使用哪种语言,大多数时间是足够的. **注意:** [Web IDE](web_ide/index.html)和[代码片段](../snippets.html)使用[Monaco Editor](https://microsoft.github.io/monaco-editor/)进行文本编辑,而在内部使用[Monarch](https://microsoft.github.io/monaco-editor/monarch.html)库进行语法突出显示. 如果 GitLab 在猜测错了,你可以覆盖其选择使用语言的`gitlab-language`的属性`.gitattributes` . 例如,如果您在 Prolog 项目中工作并使用`.pl`文件扩展名(通常以 Perl 突出显示),则可以将以下内容添加到`.gitattributes`文件中: ``` *.pl gitlab-language=prolog ``` 当您签入并进行更改时,项目中的所有`*.pl`文件都将突出显示为 Prolog. 这里的路径只是 Git 内置的[`.gitattributes`接口](https://git-scm.com/docs/gitattributes) . 因此,如果您要在使用 Ruby 语法的项目根目录下发明一种名为`Nicefile`的文件格式,那么您需要做的就是: ``` /Nicefile gitlab-language=ruby ``` 要完全禁用突出显示,请使用`gitlab-language=text` . 可通过 CGI 选项获得更多有趣的恶作剧,例如: ``` # json with erb in it /my-cool-file gitlab-language=erb?parent=json # an entire file of highlighting errors! /other-file gitlab-language=text?token=Error ``` 请注意,这些配置仅在`.gitattributes`文件位于默认分支(通常为`master` )中时才生效. **注意:** Web IDE 不支持`.gitattribute`文件,但已[计划在将来的发行版中使用](https://gitlab.com/gitlab-org/gitlab/-/issues/22014) .