Linguist syntax highlighting for Drupal file types


drupal

Drupal uses a few unusual file extensions that contain PHP - notably .module, .theme, and .install.

GitHub use linguist for language detection. You can configure linguist using a .gitattributes file in your repo.

Add a .gitattributes file with the following contents to your Drupal repo:

# linguist configuration for syntax highlighting in github UI.
*.module linguist-language=PHP
*.install linguist-language=PHP
*.theme linguist-language=PHP

Now your pull requests and source viewer in Github should have PHP syntax highlighting for these file extensions.