In order to format code in a numbered or bulleted list, you need to indent it eight spaces instead of the usual four. This is by design.
If the Sample Code button is pressed when a user has a block of code highlighted, it automatically indents everything four lines. This is very useful.
Feature request
I request that if the highlighted block of code follows a list item, that every line be automatically indented 8 spaces instead of 4.
In the current situation I have to add the additional spaces to every line by hand. This is inconvenient.
Duplicate
This question is a duplicate.
- It was asked here, but the question was unclear and misunderstood to be a duplicate of this question.
- It was also asked here but has received no response.
This a list item. It is unrelated to the rest of the list.
// I pressed the Sample Code button but then had to add an extra 4 spaces by hand in order to make this be formatted as code. I don't really mind doing this for a single line of code, but for multiple lines it is kind of a pain.
.
(or any other character) at the start of a newly added line just after the code block and then indent the code block plus the line with the dot again, and then remove the line with the dot on it. That's not incredibly sophisticated, but it works, and is easier than indenting a multi-line block of code by 4 spaces manually. And I see this is what halfer suggests in this answer.