Developer's EPUB converter learns spine order, not filenames, defines chapter sequence
A developer building an EPUB-to-Markdown converter found that alphabetical file ordering produced chapters in the wrong sequence, since EPUB reading order is defined by the spine in the content.opf control file. Switching to follow the spine, with each entry resolved to its manifest item, fixed the ordering. The developer also reported that footnotes and sidebars stored as separate XHTML files were initially dropped, so they are now inlined at their reference points. Support for both EPUB2 and EPUB3 navigation formats required a compatibility shim. The author concluded that the file listing is not the reading order and the table of contents is not the structure, and packaged the tool as an API for feeding chapter-structured text into RAG pipelines.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in