Noam Noam - 1 year ago 220
Markdown Question

Diff syntax highlighting in Github Markdown

I'm writing documents that should explain code in C# using Markdown.

I use the

to get csharp highlighting.

I sometimes want to highlight something specific in the code using bold or anything.

I know about
etc... but it takes away my csharp highlighting.

Best case scenario - some way to highlight code in the

Next best thing - I can write the code as diff - using + and - to highlight stuff, but how do I tell Github to highlight diff syntax with the red and green backcolor?

Is there a way to use both diff and csharp syntax highlighting?

Answer Source

Github's markdown supports diff when formatting code. For example:

public class Hello1
   public static void Main()
-      System.Console.WriteLine("Hello, World!");
+      System.Console.WriteLine("Rock all night long!");

and it should give you the Diff looks you are looking for, highlighting in red what has been removed and in green what has been added.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download