Flatten / Transform a Nested Block Tree
Problem
Docs are trees of blocks. Given a nested block structure, flatten it to an ordered list (with depth), or move a block subtree to a new parent preserving order.
Example
blocks tree -> ordered [(block, depth)]; move(subtree, newParent)
Constraints
- Arbitrary nesting; preserve sibling order
What evaluators look for
Practical coding in JS/TS over a real data model. Handle edge cases (move into own descendant).
added …