Amelio Vazquez-Reina
Amelio Vazquez-Reina

Reputation: 96274

Syntax highlighting on GitHub's Wiki: Specifying the programming language

GitHub uses something known as the "GitHub Flavored Markdown" for messages, issues and comments. My questions are:

Upvotes: 20

Views: 10599

Answers (3)

pchaigno
pchaigno

Reputation: 13103

How do I look up the specifier for a programming language?

The up-to-date list of language specifiers can be deduced from the main configuration file of the Linguist repository, languages.yml. For each language in that list, you can use as specifiers:

  1. The language name
  2. Any of the language aliases
  3. Any of the file extensions, with or without a leading ..

White spaces must be replaced by dashes (e.g., emacs-lisp is one specifier for Emacs Lisp). Languages with a tm_scope: none entry don't have a grammar defined and won't be highlighted on github.com.

jmm made this reverse engineering effort and received confirmation from one of GitHub's engineers. He opened an issue with all the information on Linguist and maintains a wiki page with the specifiers for all languages (which might not be up-to-date).

Does GitHub also use this syntax for their Wiki?

Yes, but github.com's wikis also supports several other formats. You can find the complete list on the markup repository.

Upvotes: 2

3D1T0R
3D1T0R

Reputation: 1060

Quoting GitHub's documentation on the subject:

We use Linguist to perform language detection and syntax highlighting. You can find out which keywords are valid in the languages YAML file.

Linguist's "Grammar index" may prove also useful.

Upvotes: 6

Robert H
Robert H

Reputation: 11730

For a list of the possible lexers that github wiki can use see here: http://pygments.org/docs/lexers/

If you find that a certain lexer is not supported, github recommends forking their code and submitting it via a pull request: https://github.com/blog/774-git-powered-wikis-improved

Upvotes: 10

Related Questions