Skip to content

Add custom highlighting via .gitattributes

jneen requested to merge feature/custom-highlighting into master

What does this MR do?

Allows user control of language selection via a gitlab-language entry in .gitattributes

Are there points in the code the reviewer needs to double check?

(paired with @stanhu)

Why was this MR needed?

Guessing languages by filename is fraught and often wrong. In one project, foo.pl may be perl, and in another it may be prolog. Users might have a Thingfile that needs ruby highlighting, or depend on things that can't work in general, like *.C (capitalized) mapping to C++ instead of C.

This allows the user to override language choice so they never have to look at a mis-highlighted file.

What are the relevant issue numbers?

https://github.com/jneen/rouge/issues/494 https://gitlab.com/gitlab-org/gitlab-ce/issues/13818 (*.tpl can't in general map to Smarty) https://gitlab.com/gitlab-org/gitlab-ce/issues/13615 (in cases we don't have a language and mis-identify it, users could map to 'text' to turn off highlighting)

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

Merge request reports