github

indent code correctly in Github list item in README.md


I'm creating README.md file for my Repo in github, but i cant indent the code blocks as much as my list items has indent from the left, I'm trying as bottom and i want this block of code to start with indention of list items.

* list
  * Item one
  * ``` codes here..```

also it didn't worked :( don't know why.

Skip a line and indent eight spaces. Eight spaces will trigger the code block.


Solution

  • You need to add blank lines to make it work with the 8 spaces. Now because your item one is already 4 spaces in you need to add 12 spaces (4 + 8 = 12) like so

    * list
        * item one
    
                codes here..
    

    Which will then look like: