GitHub – Language Tag for .gitignore Code Block in Markdown

githubmarkdown

I have a README.md in a repository on GitHub that shows a code block of an example .gitignore.
I know that one can mark a code block with a language tag in GitHub Flavored Markdown (GFM).
For example, the following would be properly prettified in GFM:

json
{
  "json": true
}

Also, I know that the definitive list of languages supported by GFM is the languages.yml in the linguist repository.
However, I cannot figure out which of those language tags I should use.

I tried gitignore even though it isn’t on the list of supported languages, but it doesn’t get highlighting:

gitignore
# Common editor swap files
*.swp
*~
*\#*

What tag should I use in this case?

EDIT: I have opened linguist#4225

Best Answer

This has been added to linguist: https://github.com/github/linguist/pull/4343

The tag you should use is ignore-list, as in

```ignore-list
# Common editor swap files
*.swp
*~
*\#*
```

Apparently it also supports gitignore as an alias for ignore-list.