Diff syntax highlighting in Github Markdown

前端 未结 2 459
一整个雨季
一整个雨季 2021-02-01 11:50

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

I use the ```csharp to get csharp highlighting.

I sometimes want to highlight

2条回答
  •  囚心锁ツ
    2021-02-01 11:58

    Salvador's response is correct, however, I found out that you should add the diff header to the code snippet in order to highlight it:

    ``` diff
    diff --git a/filea.extension b/fileb.extension
    index d28nd309d..b3nu834uj 111111
    --- a/filea.extension
    +++ b/fileb.extension
    @@ -1,6 +1,6 @@
    -oldLine
    +newLine
    ```
    

    I hope that helps!

提交回复
热议问题