Nested bookmarks survive a chapter split
The numbers first: 6 bookmarks in (2 top-level chapters, 4 level-2 sub-bookmarks), split by chapter produced 2 chapter files, read back 6/6 with hierarchy intact — all 4 sub-bookmarks kept, every destination verified against page text.
This is the third run in the bookmark series, after the same-page overlap fix and the raw-split 0/10 finding. Today's question: what happens to child bookmarks when their parent chapter becomes its own file?
The executed run
- Built an 8-page PDF with a nested outline:
Chapter 1(p1) with children1.1 Intro(p1) and1.2 Method(p2);Chapter 2(p4) with children2.1 Results(p4) and2.2 Notes(p5). - Split by top-level chapter: chapter end = next chapter start − 1, so Chapter 1 = pages 1–3, Chapter 2 = pages 4–8.
- Rule: keep every bookmark whose destination page falls inside the chapter — children travel with their page, not with their parent's label — remap
page’ = page − start + 1, levels unchanged. - Read back: Chapter 1 kept 3 bookmarks (levels 1,2), Chapter 2 kept 3 (levels 1,2). 6/6 total, 4/4 sub-bookmarks, no level flattening.
What the hierarchy rule means
A child bookmark is not attached to its parent entry — it is attached to a destination page. When the split puts that page in a chapter file, the child goes with it and keeps its level. The practical check: per-file bookmark counts sum to the source outline (3 + 3 = 6), and no child appears without its parent-level context in the same file.
Not tested here — the list stays honest
Level-3+ depth, a child pointing outside its parent's page range, and bookmark trees in scanned PDFs were not in today's run. The numbers above cover exactly what was executed.