Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add Markdown formatting in a code / pre block?

This may seem to defeat the purpose of a code block, but I'd like to be able to bold something within a code block. For example, if I wanted to bold the return line:

int main(void) {
    **return 0;**
}
like image 358
wting Avatar asked Apr 08 '12 15:04

wting


2 Answers

You would have to do this in HTML, by design.

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically.

<pre> int main(void) {     <b>return 0;</b> } </pre> 
like image 178
Zombo Avatar answered Sep 25 '22 17:09

Zombo


This syntax should solve your problem :

    ```
    int main(void) {
       **return 0;**
    }
    ```

Just type three backticks in the beginning of the code block and it's should work.

like image 42
Arsen Avatar answered Sep 21 '22 17:09

Arsen