Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Does GitHub also use this syntax for their Wiki?
  • From what I understand one can specify the programming language for syntax highlighting using the following syntax:

    ```ruby  
    require 'redcarpet'  
    markdown = Redcarpet.new("Hello World!")  
    puts markdown.to_html  
    ```
    

    Where one can specify the programming language after the ``` string (e.g. ```ruby)

    My question is: How do I look up the specifier for a programming language? (e.g. C does not seem to work for the C programming language)

like image 482
Amelio Vazquez-Reina Avatar asked Jul 19 '12 19:07

Amelio Vazquez-Reina


People also ask

How do you specify a language in Markdown?

Many Markdown processors support syntax highlighting for fenced code blocks. This feature allows you to add color highlighting for whatever language your code was written in. To add syntax highlighting, specify a language next to the backticks before the fenced code block.

How does syntax highlighting help programmer identify coding problems?

Syntax highlighting is one strategy to improve the readability and context of the text; especially for code that spans several pages. The reader can easily ignore large sections of comments or code, depending on what they are looking for. Syntax highlighting also helps programmers find errors in their program.

What does GitHub use for syntax highlighting?

We use Linguist to perform language detection and to select third-party grammars for syntax highlighting.

How do I write code in GitHub issue?

Creating an issue from code On GitHub.com, navigate to the main page of the repository. Locate the code you want to reference in an issue: To open an issue about code in a file, navigate to the file. To open an issue about code in a pull request, navigate to the pull request and click Files changed.


1 Answers

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

like image 53
Robert H Avatar answered Oct 26 '22 12:10

Robert H