goodvibration
goodvibration

Reputation: 6206

Based on what does GitHub decide how and where to apply colors within the README.md file?

I've been trying to figure this out by observing various README files on public repositories.

If seen stuff like encapsulating a function with ```cs on top and ``` on bottom.

Then in some places I've seen bash or diff instead of cs.

But I haven't been able to apply any of these options in my own README file and get them to produce the same colors.

Does it possibly have anything to do with the .gitattributes file?

Upvotes: 0

Views: 88

Answers (1)

MarvinJWendt
MarvinJWendt

Reputation: 2684

When you have a JavaScript snippet you can highlight the content via:

```javascript
content
```

(Read more here: https://help.github.com/en/articles/creating-and-highlighting-code-blocks)


The .gitattributes file is not needed for the README.md. It is needed when GitHub (Linguist) highlights a whole file in a wrong syntax


Last but not least, syntax highlighting in GitHub is made possible by the GitHub project linguist.

Upvotes: 2

Related Questions