Commit a81e92ce authored by Marcia Ramos's avatar Marcia Ramos

Merge branch '208731-ide-language-differences' into 'master'

Add docs about syntax highlighting differences

Closes #208731

See merge request gitlab-org/gitlab!34297
parents 417b1e83 5bd1c700
...@@ -63,7 +63,10 @@ Dark theme currently only works with the 'Dark' syntax highlighting. ...@@ -63,7 +63,10 @@ Dark theme currently only works with the 'Dark' syntax highlighting.
NOTE: **Note:** NOTE: **Note:**
GitLab uses the [rouge Ruby library](http://rouge.jneen.net/ "Rouge website") GitLab uses the [rouge Ruby library](http://rouge.jneen.net/ "Rouge website")
for syntax highlighting. For a list of supported languages visit the rouge website. for syntax highlighting outside of any Editor context. The WebIDE (like Snippets)
uses [Monaco Editor](https://microsoft.github.io/monaco-editor/) and it's provided [Monarch](https://microsoft.github.io/monaco-editor/monarch.html) library for
syntax highlighting. For a list of supported languages, visit the documentation of
the respective libraries.
Changing this setting allows you to customize the color theme when viewing any Changing this setting allows you to customize the color theme when viewing any
syntax highlighted code on GitLab. syntax highlighted code on GitLab.
......
# Syntax Highlighting # Syntax Highlighting
GitLab provides syntax highlighting on all files and snippets through the [Rouge](https://rubygems.org/gems/rouge) rubygem. It will try to guess what language to use based on the file extension, which most of the time is sufficient. GitLab provides syntax highlighting on all files through the [Rouge](https://rubygems.org/gems/rouge) Ruby gem. It will try to guess what language to use based on the file extension, which most of the time is sufficient.
NOTE: **Note:**
The [Web IDE](web_ide/index.md) and [Snippets](../snippets.md) use [Monaco Editor](https://microsoft.github.io/monaco-editor/)
for text editing, which internally uses the [Monarch](https://microsoft.github.io/monaco-editor/monarch.html)
library for syntax highlighting.
If GitLab is guessing wrong, you can override its choice of language using the `gitlab-language` attribute in `.gitattributes`. For example, if you are working in a Prolog project and using the `.pl` file extension (which would normally be highlighted as Perl), you can add the following to your `.gitattributes` file: If GitLab is guessing wrong, you can override its choice of language using the `gitlab-language` attribute in `.gitattributes`. For example, if you are working in a Prolog project and using the `.pl` file extension (which would normally be highlighted as Perl), you can add the following to your `.gitattributes` file:
...@@ -27,3 +32,6 @@ To disable highlighting entirely, use `gitlab-language=text`. Lots more fun shen ...@@ -27,3 +32,6 @@ To disable highlighting entirely, use `gitlab-language=text`. Lots more fun shen
``` ```
Please note that these configurations will only take effect when the `.gitattributes` file is in your default branch (usually `master`). Please note that these configurations will only take effect when the `.gitattributes` file is in your default branch (usually `master`).
NOTE: **Note:**
The Web IDE does not support `.gitattribute` files, but it's [planned for a future release](https://gitlab.com/gitlab-org/gitlab/-/issues/22014).
...@@ -38,7 +38,10 @@ The Web IDE currently provides: ...@@ -38,7 +38,10 @@ The Web IDE currently provides:
Because the Web IDE is based on the [Monaco Editor](https://microsoft.github.io/monaco-editor/), Because the Web IDE is based on the [Monaco Editor](https://microsoft.github.io/monaco-editor/),
you can find a more complete list of supported languages in the you can find a more complete list of supported languages in the
[Monaco languages](https://github.com/Microsoft/monaco-languages) repository. [Monaco languages](https://github.com/Microsoft/monaco-languages) repository. Under the hood,
Monaco uses the [Monarch](https://microsoft.github.io/monaco-editor/monarch.html) library for syntax highlighting.
If you are missing Syntax Highlighting support for any language, we prepared a short guide on how to [add support for a missing language Syntax Highlighting.](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/ide/lib/languages/README.md)
NOTE: **Note:** NOTE: **Note:**
Single file editing is based on the [Ace Editor](https://ace.c9.io). Single file editing is based on the [Ace Editor](https://ace.c9.io).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment