spine
The spine is an element in the EPUB OPF file that references resource IDs from the manifest via itemref elements in linear reading order, and is the authoritative source for defining a book's reading order.
Timeline (last 90 days)
In an EPUB's OPF file, the manifest lists all resource entries by ID, while the spine lists these IDs in reading order.
An EPUB's table of contents file (toc.ncx or, in EPUB3, the nav document) may not match the spine order and cannot be equated with the book's linear structure.
Parsing the spine is the correct way to determine EPUB reading order: for each itemref, resolve its ID to the manifest entry and then read the corresponding file; if a spine entry points to a non-XHTML resource, it should be skipped gracefully.
In EPUB spine entries, the linear="no" attribute indicates that the document is auxiliary content that can be skipped during linear reading.
Translating paragraph by paragraph is too slow and loses context; the actual pipeline extracts all paragraphs of the whole book in spine order, sends them to the LLM in batches of 50 paragraphs, and maps the results back in the same order to the corresponding elements in each XHTML file.
In an OPF file, the manifest lists every file in the book, and the spine is an ordered set of itemref elements that specifies the reading order in declaration sequence
The correct parsing process is: read container.xml to locate the OPF, parse the manifest to build an id-to-href mapping, then traverse and convert in the itemref declaration order of the spine
EPUB 3 additionally introduced the Navigation Document (nav.xhtml) as a human-readable table of contents, but the spine remains the authoritative source for programmatic parsing of reading order
All Facts (8)
In an EPUB's OPF file, the manifest lists all resource entries by ID, while the spine lists these IDs in reading order.
50%UnverifiedAn EPUB's table of contents file (toc.ncx or, in EPUB3, the nav document) may not match the spine order and cannot be equated with the book's linear structure.
50%UnverifiedParsing the spine is the correct way to determine EPUB reading order: for each itemref, resolve its ID to the manifest entry and then read the corresponding file; if a spine entry points to a non-XHTML resource, it should be skipped gracefully.
50%UnverifiedIn EPUB spine entries, the linear="no" attribute indicates that the document is auxiliary content that can be skipped during linear reading.
50%UnverifiedTranslating paragraph by paragraph is too slow and loses context; the actual pipeline extracts all paragraphs of the whole book in spine order, sends them to the LLM in batches of 50 paragraphs, and maps the results back in the same order to the corresponding elements in each XHTML file.
50%UnverifiedIn an OPF file, the manifest lists every file in the book, and the spine is an ordered set of itemref elements that specifies the reading order in declaration sequence
50%UnverifiedThe correct parsing process is: read container.xml to locate the OPF, parse the manifest to build an id-to-href mapping, then traverse and convert in the itemref declaration order of the spine
50%UnverifiedEPUB 3 additionally introduced the Navigation Document (nav.xhtml) as a human-readable table of contents, but the spine remains the authoritative source for programmatic parsing of reading order
50%