jennifer registry

@deckyard/epub

Read and write EPUB books: metadata, chapters, table of contents, images and styles

epubebookxhtmlopfmarkdown

Depend on it

[decks]
"@deckyard/epub" = "^0.3.1"

Versions

VersionStatusKindPinRequiresEnginesCapabilities
0.3.1livegit50371d482792-jennifer >=0.28.0 jennifer-tiny >=0.28.0-
0.3.0livegit2e96a85c6f16-jennifer >=0.27.0 jennifer-tiny >=0.27.0-
0.2.0livegite1f0084b69e4-jennifer >=0.26.0 jennifer-tiny >=0.26.0-
0.1.0livegit3cf38d8190c1-jennifer >=0.26.0 jennifer-tiny >=0.26.0-

License

LGPL-3.0-only

Source

Released from
0.3.1
Published under
@deckyard mplx
Repository owner
deckyard

Resolutions

Times a client asked this registry where to find this deck. Not downloads: the registry only stores metadata, and the code is fetched from its repository directly, so we never see an install and cannot count one. Repeated builds inflate these numbers; installs from an existing lockfile do not appear at all. Counted in UTC.

Readme

@deckyard/epub

test Documentation release

Read and write EPUB™ books in a Jennifer program, in pure Jennifer. Writing builds EPUB 3.3 (with an optional EPUB 2 toc.ncx) from XHTML or Markdown chapters, a cover, pictures and a stylesheet, deterministically: the same book gives the same bytes, stored or (optionally) deflated, left-to-right or right-to-left, reflowable or fixed-layout, with landmarks and a page list. Batch builders add many chapters or pictures in one call, and check lists links in the book that lead nowhere; rename moves a file and the links to it, and writable makes a read book (EPUB 2 chapters, fixed-layout comics, media overlays) one build writes cleanly. Reading takes EPUB 2 and 3 files and returns the metadata, the chapters in reading order, the table of contents, the other files, the landmarks and page list, the fixed-layout settings and each chapter as plain text; chapters that are not well-formed XML are read as HTML, common faults (a declared legacy charset, a missing or case-mismatched file, an imperfect mimetype) are tolerated and listed in the book's notes, and DRM-protected books are refused with a catchable error.

Documentation

Install

jvc add @deckyard/epub

This vendors the deck to vendor/<scope>/epub/. Without jvc, unpack the src/ subtree of a release archive (<scope>-epub-<version>.tar.gz) there.

Usage

import "@deckyard/epub/" as epub;

def b as epub.Book init epub.book("Field Notes", "en");
$b = epub.author($b, "Ada Lovelace");
$b = epub.markdownChapter($b, "one.xhtml", "Observations", "# Observations\n\nThe engine weaves.\n");
fs.writeBytes("notes.epub", epub.build($b));

def back as epub.Book init epub.read(fs.readBytes("notes.epub"));
for (def c in $back.chapters) {
    io.printf("%s\n%s\n", $c.title, epub.text($c));
}

Requirements

Jennifer 0.28.0 or newer. No capability: the deck works on bytes and does no file, network or process access of its own. It uses the archive, xml, crc, hash and encoding libraries and the bundled markdown and html modules. Runs on jennifer-tiny too, within its smaller nesting and memory limits (see the reading guide).

Development

tools/check-all.sh                 # the full gate, as CI runs it
jennifer test src/epub_test.j      # the test overlays
tools/check-docs.sh                # docs against the code
tools/build-fixtures.sh            # regenerate the Gutenberg fixtures (network)
tools/pack.sh dist                 # build the release archive

tools/check-extra.sh also validates a built book with EPUBCheck when Docker™ and the EPUBCheck jar are available (EPUBCHECK_JAR=/path/to/epubcheck.jar), and skips that check otherwise.

Trademarks

EPUB™ is a trademark of the World Wide Web Consortium, Inc. (W3C). Adobe™ is a trademark of Adobe Inc. Apple™ and FairPlay™ are trademarks of Apple Inc. Project Gutenberg™ and other product and company names may be trademarks of their respective owners. They are used only to identify the formats and products this deck works with. This deck is an independent project, not affiliated with, sponsored or endorsed by the W3C, the Project Gutenberg Literary Archive Foundation, Adobe Inc. or Apple Inc.

Licence

LGPL-3.0-only, see LICENSE. Copyright (C) 2026 mplx <[email protected]>.

The tests read Project Gutenberg™ eBook #1080 (Jonathan Swift, "A Modest Proposal", public domain) from testdata/gutenberg/: Project Gutenberg's own files, unmodified, under the Project Gutenberg licence included in them. They are not part of the deck's src/; see testdata/gutenberg/README.md.

tools/check-headers.sh checks every source file's SPDX header against deck.toml.

This deck as JSON