Fix a bug where some nested headers would get appended to the incorrect ...

...section (e.g.: an H4 right after an H2 could be appended to an H3 further up in the content).