Highlighting specific code parts in GitHub Markdown for C#

Hey everyone! I’m working on some C# docs using Markdown and I’m stuck. I know how to use ```csharp for syntax highlighting, but I want to make certain parts of the code stand out more. Is there a way to do this without losing the C# highlighting?

I’ve tried using

 tags, but that messes up the syntax coloring. What I really want is to highlight specific lines or words within the ```csharp block.

I was thinking maybe I could use diff syntax (with + and -) to add some color, but I’m not sure how to make GitHub recognize it as a diff while keeping the C# highlighting.

Has anyone figured out a good way to do this? Any tips or tricks would be super helpful! Thanks!

hey ethan, have u tried using HTML comments within the code block? like this:

public void SomeMethod()
{
    // Normal code
    <!-- highlight-next-line -->
    var importantVariable = 42;
    // More code
}

it keeps the c# highlighting and lets u emphasize specific parts. might be what ur looking for!