shayla.sawchenko.net

How to indent code in Markdown (.md) files

15 September 2013 - Filed under jekyll

Seems simple, but it took me some digging to find this.

To indent code blocks in markdown files, simply add 4 blank spaces in front of the code block from within the list.

Watch: White spaces matter! There must be a linebreak after the list item, but before the code block

Exact .md:

* This is a list item   
 
    ```javascript 
var i = "this is my code block!";
var j = "i added indentation before the ``` ";
```

becomes:

  • This is a list item

    var i = "this is my code block!";
    var j = "i added indentation before the  ``` ";
    

And that's it! Huzzah!

by Shayla Sawchenko