summaryrefslogtreecommitdiff
path: root/doc/user/project/highlighting.md
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2016-06-23 11:08:04 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2016-06-27 14:17:49 -0700
commit8c15989621f6fb7e225d279ec66ab82f084ca11c (patch)
tree022691dbef1312593466e8a0de02b3f3e36f0930 /doc/user/project/highlighting.md
parent66b37149eb72179e1b6329221b8a92e226e4e563 (diff)
downloadgitlab-ce-8c15989621f6fb7e225d279ec66ab82f084ca11c.tar.gz
first draft of docs
Diffstat (limited to 'doc/user/project/highlighting.md')
-rw-r--r--doc/user/project/highlighting.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/user/project/highlighting.md b/doc/user/project/highlighting.md
new file mode 100644
index 00000000000..0cc2edf5283
--- /dev/null
+++ b/doc/user/project/highlighting.md
@@ -0,0 +1,29 @@
+[Rouge]: https://rubygems.org/gems/rouge
+
+# Syntax Highlighting
+
+GitLab provides syntax highlighting on all files and snippets through the [Rouge][] rubygem. It will try to guess what language to use based on the file extension, which most of the time is sufficient.
+
+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:
+
+``` conf
+*.pl gitlab-language=prolog
+```
+
+When you check in and push that change, all `*.pl` files in your project will be highlighted as Prolog.
+
+The paths here are simply git's builtin [`.gitattributes` interface](https://git-scm.com/docs/gitattributes). So, if you were to invent a file format called a `Nicefile` at the root of your project that used ruby syntax, all you need is:
+
+``` conf
+/Nicefile gitlab-language=ruby
+```
+
+To disable highlighting entirely, use `gitlab-language=text`. Lots more fun shenanigans are available through CGI options, such as:
+
+```
+# 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
+```