If the hierarchy is based on heading style (H1, H2,..) then it will be more flexible and pleasant to look. By this way, the entire document will be structured, with sections -> sub sections -> sub sub sections and so on.
Integrity knows the item category only when it is saved. So this sectioning has to be performed during saving an item.
If their is a possibility of this trigger slows down the operation, then a menu shall provide to "Format Sections" of entire document. This is almost similar to doing format of HTML/XML source code 🙂