Home > database >  Why is Github using different syntax highlighting for same file type?
Why is Github using different syntax highlighting for same file type?

Time:12-18

I have two assembly files on github that should have the same syntax highlighting, but they do not as shown in the images below. The first image is wrong, comments are not grayed out, and the second image is right. Any ideas how to fix the first image? Wrong Syntax Highlighting

Correct Syntax Highlighting

CodePudding user response:

They are probably being detected as different types of files. GitHub uses the Linguist library for this, but it's not perfect. In addition, assembly files are specifically very hard to detect because different assemblers have different register names, syntaxes, and comment forms.

You can specify an override in your .gitattributes file as specified in the Linguist documentation to force your file to be detected properly.

  • Related