0

Noticed a bug when edited a question. If You have a list with multi-level items, inserting code in the middle of them, breaks level indentions for further list items after the code.

See example below - indention for list item 1.3. is broken (displayed as a first level item, not second) and it resets indentions for further list items, based on 1.3. item.

  1. first, open this

    1.1. then click that

    1.2. execute code below

sample code
lorem
ipsum

1.3. check if everyting is OK <<--- indention displayed as first level item

  1. then switch to this

    2.1. move this from here to there

    2.2. all done

Is there a way to format question with correct indentions after the code is placed in the middle of list items? Or this formatting is not allowed/recommended - insert code in the middle of lists?

1 Answer 1

2

It is possible to add code block in the list while properly formatting it. You need to add enough spaces (6 or more) for the code block to have the same level as the list item's indent.


  1. first, open this

    1.1. then click that

    1.2. execute code below

    sample code
    lorem
    ipsum
    

    1.3. check if everyting is OK <<--- indention correctly displayed as second level item

  2. then switch to this

    2.1. move this from here to there

    2.2. all done


Markdown (with trailing dots for clarity, replace with whitespace instead)

1. first, open this

.1.1. then click that

.1.2. execute code below

........sample code
........lorem
........ipsum

.1.3. check if everyting is OK <<--- **indention correctly displayed as second level item**

2. then switch to this

.2.1. move this from here to there

.2.2. all done
1
  • Yes, it works! Thank You! :) Commented Apr 1, 2019 at 13:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .