Skip to content

Add EPUB export format with dropdown selector#55

Merged
amoghbanta merged 5 commits intomainfrom
feat/adt-preview-and-export
Feb 17, 2026
Merged

Add EPUB export format with dropdown selector#55
amoghbanta merged 5 commits intomainfrom
feat/adt-preview-and-export

Conversation

@amoghbanta
Copy link
Collaborator

Summary

  • Export buildImageMap, rewriteImageUrls, and new htmlToXhtml helper from @adt/pipeline for reuse
  • Add epub-service.ts that generates valid EPUB3 packages from stored book data (chapters as XHTML, images, metadata in content.opf, nav in toc.xhtml)
  • Add ?format=web|epub query param to the existing export endpoint
  • Replace the single Export button with a dropdown offering "ADT Web (.zip)" and "EPUB (.epub)"
  • 9 new tests covering EPUB structure, content, images, metadata, script stripping, and error cases

Test plan

  • pnpm test — all 488 tests pass (including 9 new EPUB tests)
  • pnpm typecheck — clean
  • Manual: open a book with accepted storyboard, click Export dropdown, download both formats
  • Manual: open .epub in Apple Books or Calibre — pages render with images

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.
@amoghbanta amoghbanta merged commit 390c87c into main Feb 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant