Handling Lists Hierarchy

Scenario 1

Input:

block1
|block2
  block3
  block4

output:

block1|block2
  block3
  block4
    check if the prev block that will be merged is at the same level
    check that the current block have children
    reparent all the current block children to the prev block as children
    check the current block is not the first item of the parent list

Scenario 2

Input:

block1
  block2
|block3
    block4

output:

block1
  block2|block3
    block4

Scenario 3

Input:

block1
  block2
    block3
      block4
        block5
|block6
  block7

output:

block1
  block2
    block3
      block4
        block5|block6
  block7