Problem/Motivation

Currently files such as *.module, *.install etc, are not highlighted properly on GitHub. See https://github.com/drupal/drupal/blob/8.8.x/core/modules/ban/ban.module for an example.

We can fix that using the linguist-language key provided by the Github's Linguist library used on github.com.

See example here: https://github.com/johndevman/d8-gitattributes/blob/master/.gitattributes
https://github.com/johndevman/d8-gitattributes/blob/master/test.module

Proposed resolution

Update .gitattributes and the linguist-language key for *.module, *.theme, *.install, *.profile, etc.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johndevman created an issue. See original summary.

xjm’s picture

Version: 9.0.x-dev » 9.1.x-dev

Thanks for filing this!

Only bug fixes and allowed changes during the beta phase should be filed against 9.0.x. New features, API additions, and deprecations should be filed against 9.1.x.

So, moving to the 9.1.x-dev branch.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

hugovk’s picture

I've attached a patch to add syntax highlighting for GitHub.

Status: Needs review » Needs work

The last submitted patch, 4: 3119840-support-syntax-highlighting-on-github.patch, failed testing. View results

raman.b’s picture

dawehner’s picture

Status: Needs review » Needs work

I've done the same change recently on one my my projects and it's quite nice to have this available.

On the patch: I believe this needs some work, as the scaffold file isn't changed, see https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/assets/scaff... and as such this would not end up on actual sites.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jdleonard’s picture

Status: Needs work » Needs review

I believe the comment in #7 was referring to an old version of the patch. The patch in #6 appears to affect the scaffold file as expected.

quietone’s picture

Status: Needs review » Needs work

Back to NW for a working patch on 9.4.x.

Spokje’s picture

Status: Needs work » Needs review

Patch #6 seems still valid on 9.4..x-dev

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

RTBC, this works great. Patch can't be applied to projects using recommended project template and composer-patches as .gitattributes is scaffolded into a different location, but it works well when the change is applied manually.

alexpott’s picture

Category: Feature request » Task
Status: Reviewed & tested by the community » Fixed

Committed and pushed f42a2f544e to 10.1.x and ff2599d23d to 10.0.x and 2ee35e2352 to 9.5.x. Thanks!

  • alexpott committed f42a2f5 on 10.1.x
    Issue #3119840 by raman.b, hugovk, johnwebdev, dawehner: Support syntax...

  • alexpott committed ff2599d on 10.0.x
    Issue #3119840 by raman.b, hugovk, johnwebdev, dawehner: Support syntax...

  • alexpott committed 2ee35e2 on 9.5.x
    Issue #3119840 by raman.b, hugovk, johnwebdev, dawehner: Support syntax...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.