1

I have a repository that has Python source code in it, but the files are suffixed *.pyp. Is there a way to "assign it" to the Python language? (shown in tags, syntax highlighting, etc.)

I thought I saw something like this possible in the .gitattributes file..

Cœur
  • 37,241
  • 25
  • 195
  • 267
Niklas R
  • 16,299
  • 28
  • 108
  • 203
  • 1
    Here is the answer to the same question: http://webapps.stackexchange.com/questions/31654/force-github-syntax-highlighting-language-on-source-files – Prakash Murthy Feb 06 '13 at 17:45

2 Answers2

1

For files with a Shebang, the Shebang is considered when determining the language but seems to be evenly weighted against other tokens. This seems to be a big error because the Shebang should definitively define the language of the file. This can cause issues with highlighting.

As a workaround you can add dummy tokens in the form of a comment to "tip the scales" in favor of the correct language. This is experimental but I have had luck with it.

Zombo
  • 1
  • 62
  • 391
  • 407
1

I thought I saw something like this possible in the .gitattributes file..

Yes, this is possible using Linguist overrides. You'd want:

*.pyp linguist-language=Python

However, .pyp is recognized by Linguist since June 2014 (after your question's date).

pchaigno
  • 11,313
  • 2
  • 29
  • 54