How can I highlight deleted and added lines like in this comment? How do I make it look like a git diff?

Do I have to use HTML? Or is there some tricky syntax like strikethrough?

1 Answer 1


That is done by using a code block with the "diff" syntax. The raw markdown would look something like this:

One small step for 

I've made a gist also that demonstrates the code (click "Raw" to view the markdown).

  • Thanks! Not knowing this had been bugging me for a long time. Out of curiosity, where is this documented? I couldn't find it anywhere.
    – Ashitaka
    May 29, 2014 at 13:43
  • 1
    You can see the complete list of languages they do syntax highlighting for here: github.com/github/linguist/blob/master/lib/linguist/… It is so long, diff was bound to be there!
    – John C
    May 30, 2014 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.