Update: pchaigno points out in the comments the section linguist#Overrides, where you can use for instance .gitattributes
:
Add a .gitattributes
file to your project and use standard git-style path matchers for the files you want to override to set linguist-documentation, linguist-language
, linguist-vendored
, and linguist-generated
. .gitattributes
will be used to determine language statistics and will be used to syntax highlight files. You can also manually set syntax highlighting using Vim or Emacs modelines.
$ cat .gitattributes
*.rb linguist-language=Java
Original Answer Jan. 2017
Since you cannot easily remove the GitHub highlight, you can try and use a similar workaround I suggested in "How to fix/ignore syntax error in github"
Try and add on the same line a comment with a '%
' in it, in order for the lexer (used by the syntax highlighting engine Rouge and Pygment) to not propagate the "error" to all subsequent lines.