Reputation: 843
I have the following code in a readme.me file on BitBucket:
# Instructions #
1. Add the following configuration element:
```
{
"A": 1,
"B": 2,
"C": 3
}
```
2. Second list item
When I edit view the formatted output, the code block is correctly identified as code and is contained within the list item, but the line breaks within the code block are all removed, making it difficult to read.
However, if I remove one set of leading four spaces from the code block, the line breaks are preserved correctly, but the code block is no longer part of the list, causing the second list item to start over at #1, which is not desired:
# Instructions #
1. Add the following configuration element:
```
{
"A": 1,
"B": 2,
"C": 3
}
```
2. Second list item
Is it possible to get a code block to format correctly within a list?
Upvotes: 2
Views: 1208
Reputation: 58099
You should indent the code block with 8 spaces to preserve the ordering of the list, as suggested by Chris under another question.
# Instructions #
1. Add the following configuration element:
{
"A": 1,
"B": 2,
"C": 3
}
2. Second list item
This also indents the code block to appear like it's within the list:
Upvotes: 4