Ali Aref
Ali Aref

Reputation: 2402

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.

Upvotes: 0

Views: 2069

Answers (2)

caramba
caramba

Reputation: 22480

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:

  • list
    • item one

        codes here..
      

Upvotes: 1

ozerodb
ozerodb

Reputation: 551

  • List
    • Item one
    • This is
      a code block
      I had to manually indent these lines
      
    • Item three

The above is the output of

 * List
    * Item one
    * ```
      This is
      a code block
      I had to manually indent these lines
      ```
    * Item three

Does this help?

Upvotes: 2

Related Questions