Fifteen rules · EPUB Accessibility 1.1 · WCAG 2.x · SARIF 2.1.0
Audit an EPUB and get a repaired book back.
booklens audits an EPUB against EPUB Accessibility 1.1 and WCAG 2.x, then writes a repaired EPUB. It runs offline, exits with a CI-friendly status code, and can be scripted.
curl -fsSL https://raw.githubusercontent.com/srivtx/booklens/main/install.sh | sh
Installs the booklens binary with Bun. It is not published to npm; bunx github:srivtx/booklens#main runs it without installing.
$ booklens audit fixtures/inaccessible.epuberror E008 OEBPS/chapter1.xhtml 1 image(s) missing an alt attribute.error E009 OEBPS/chapter1.xhtml html element is missing both lang and xml:lang attributes.warning W012 OEBPS/chapter1.xhtml Headings skip a level or do not begin with an h1.warning W013 OEBPS/chapter1.xhtml Table has no header cells (no <th> or role="columnheader").warning W014 OEBPS/chapter1.xhtml Link text is a raw URL: https://example.comerror E001 OEBPS/content.opf Publication is missing a dc:language declaration.error E003 OEBPS/content.opf Publication is missing schema:accessMode metadata.warning W010 OEBPS/nav.xhtml Navigation document is missing a landmarks nav element.info W011 OEBPS/nav.xhtml Navigation document has no page-list; the publication contains no pagebreaks.…inaccessible.epub: 10 error(s), 8 warning(s), 1 info
What it catches
The failures that make a book unreadable to assistive technology, and what fix does about each one.
- A book with no language or title
- An EPUB needs a declared language and title. When they are missing, booklens reports it (
E001,E002) andfixwrites them from the CLI options. - Missing accessibility metadata
- The
schema:*properties say how the book can be used. booklens flags the gaps (E003–E006,W007) andfixadds them. - Images with no alt text
- An image without an
altattribute is silent to a screen reader. booklens reports it (E008) andfixwrites a loggedalt="TODO: describe image"placeholder. - Pages with no language
- If an XHTML document has neither
langnorxml:lang, assistive technology cannot choose the right pronunciation.E009, andfixsets both. - Navigation that is incomplete
- Missing landmarks, a page-list, or a whole navigation document (
W010,W011,E015) makes a book hard to move through.fixwrites them and updates the manifest. - Structure that needs a human
- Skipped headings, tables without headers, and raw-URL link text (
W012–W014) are reported but never guessed at, because a wrong repair corrupts the book.
Quick start
Install once, then point it at a book. audit reports; fix writes a repaired EPUB.
# install the binary$ curl -fsSL https://raw.githubusercontent.com/srivtx/booklens/main/install.sh | sh# audit a book$ booklens audit book.epub# write a repaired EPUB$ booklens fix book.epub -o book.fixed.epub
Full flags, exit codes, and the TypeScript API are in Usage.
Playground
Drop a real .epub below, or audit the sample book. Everything runs in your browser; nothing is uploaded.
Runs entirely in your browser. Nothing is uploaded.
Choose or drop an .epub file
Drag a book onto this box. It never leaves this tab.
A deliberately broken EPUB
Built in memory with the same library as the CLI, then audited. Nothing is fetched.
No EPUB audited yet.
| Severity | Code | WCAG | Location | Message |
|---|
Documentation
The landing page is the pitch. The details live on four short pages.
- Rules
- The fifteen checks, how a book is audited, and what
fixchanges. - Usage
- Install, every CLI flag, the exit-code scheme, JSON output, and the library API.
- CI
- SARIF 2.1.0 and GitHub code scanning, with a workflow you can paste.
- FAQ
- Scope, limitations, and how booklens compares to ACE, EPUBCheck, and Access-Aide.