Add EPUB export format with dropdown selector#55
Merged
amoghbanta merged 5 commits intomainfrom Feb 17, 2026
Merged
Conversation
Make buildImageMap and rewriteImageUrls public exports so EPUB generation can reuse the same image resolution logic. Add a new htmlToXhtml helper that converts HTML fragments to well-formed XHTML via htmlparser2 xmlMode serialization.
Generate valid EPUB3 packages from the same storage data used by the web export. Each rendered page becomes an XHTML chapter, images are copied into OEBPS/images/, and metadata populates content.opf. Script tags are stripped since interactive features are web-only.
Cover EPUB structure validation, chapter XHTML generation, image inclusion, script stripping, metadata in content.opf, TOC nav, and error cases for missing acceptance and non-existent books.
The export endpoint now accepts ?format=web|epub to choose between ZIP and EPUB downloads. The frontend API client passes the format through and sets the correct content type on the response.
The storyboard header now shows a dropdown with two export options
instead of a single button. The mutation accepts { label, format }
and uses the correct file extension for the download.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buildImageMap,rewriteImageUrls, and newhtmlToXhtmlhelper from@adt/pipelinefor reuseepub-service.tsthat generates valid EPUB3 packages from stored book data (chapters as XHTML, images, metadata incontent.opf, nav intoc.xhtml)?format=web|epubquery param to the existing export endpointTest plan
pnpm test— all 488 tests pass (including 9 new EPUB tests)pnpm typecheck— clean.epubin Apple Books or Calibre — pages render with images