Search code examples
githubmarkdown

Highlight specific line in markdown


I'm pretty new in markdown, and I wonder if it's possible to highlight a specific line of a block of source code, like explained in this page

http://en.support.wordpress.com/code/posting-source-code/

Thanks in advance for your answers,

Edit : To be clearer, with the wordpress plugin, you can write something like this :

[code highlight="2,3"]
This line won't be highlighted.
This line will be highlighted.
This line will be highlighted.
This line won't be highlighted.
[/code]

But obviously, this isn't a markdown syntax.


Solution

  • On SO, langauge highlighting is possible as explained in Advanced Help but not formatting within code blocks.

    This is a code block
    Markdown is **not** processed
    

    You might mimic what you want by using quote:

    This line won't be highlighted.
    This line will be highlighted.
    This line will be highlighted.
    This line won't be highlighted.

    You might also mimic what you want by using two spaces at end of each line:

    This line won't be highlighted.
    This line will be highlighted.
    This line won't be highlighted.

    But of course, these are not then rendered in monospaced font nor do you get syntax highlighting.