Linguist: Syntax Highlighting

Created on 30 Apr 2015  路  11Comments  路  Source: github/linguist

Is this the library that is being used for syntax highlighting on github.com or should I be looking somewhere else?

I tried to add .module and .install (drupal files) files as PHP

*.module linguist-language=PHP
*.install linguist-language=PHP

in .gitattributes but this didn't seem to have any effect. :/

Most helpful comment

Looks like this is fixed now. I had to change a file to see my .gitattributes setting take effect on it. It seems that Klausi had the same experience.

All 11 comments

Hi @davidbarratt. Unfortunately it's not possible to use the .gitattributes overrides to manually set the highlighting yet - they're only used when calculating the repository language statistics.

One possible alternative is to use Vim/Emacs modelines in these files which _will_ override the syntax highlighting: https://github.com/github/linguist#using-emacs-and-vim-modelines

Sorry for any confusion caused here.

@arfon,

Interesting, yeah I don't want to modify all of the files (most of them are third-party), but the lack of syntax highlighting is annoying. :(

Should I submit a PR to support Drupal file extensions? (which are PHP)

Thanks!

Should I submit a PR to support Drupal file extensions? (which are PHP)

We had a go at this a while ago but concluded it wasn't possible right now sorry: https://github.com/github/linguist/pull/1343#issuecomment-91732365

The long-term focus for Linguist is currently to improve the performance of our classifier (with a Google Summer of Code project). I'm also planning on spending some time fixing the issue you originally flagged - that .gitattributes data can't be used for overriding syntax highlighting.

@arfon,

ah, I see. ok, yeah if .gitattributes could be used to override syntax highlighting globally, that would be incredible, I can just set it for the Drupal projects. :)

Has anything happened on this topic @arfon ?

Excellent timing @josephjoaquinmartin - I was actually chatting with some engineers last week at GitHub and we're planning on doing some work on this in the coming weeks. No promises but it's rapidly reaching the top of my todo list.

attababe @arfon I look forward to it. How people program without syntax highlighting, I'll never know. Thanks.

@arfon,
is it possible now to define f. e. php syntax highlighting for *.module files? If yes, can you point me to a HowTo, please?

is it possible now to define f. e. php syntax highlighting for *.module files? If yes, can you point me to a HowTo, please?

I'm afraid overrides like this still aren't possible 馃槥

Still not supported. So annoying. Srsly, maybe better use Bitbucket way? Let user to select main language for repository for syntax highlight files where your code can't detect language?

I still remember time when .module is correctly highlighted on GitHub, why it isn't possible for now?

Looks like this is fixed now. I had to change a file to see my .gitattributes setting take effect on it. It seems that Klausi had the same experience.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

siscia picture siscia  路  6Comments

BnSalahFahmi picture BnSalahFahmi  路  3Comments

FranklinYu picture FranklinYu  路  4Comments

henrywright picture henrywright  路  6Comments

TimothyGu picture TimothyGu  路  5Comments