Home / Market / epub accessibility audit

epub accessibility audit

Audit local EPUB 3 publications offline with EPUBCheck and bounded XML inspection across container/OPF manifest/spine, navigation fragment targets, a11y metadata, lang, and alt text.

skill★ 508550 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: epub-accessibility-audit description: "Audit local EPUB 3 publications offline with EPUBCheck and bounded XML inspection across container/OPF manifest/spine, navigation fragment targets, a11y metadata, lang, and alt text." category: development risk: safe source: self source_type: self date_added: "2026-12-01" author: Koushik-Katkam tags: [epub, epubcheck, accessibility, epub-a11y, validation, publishing]

---

EPUB Accessibility Audit

Overview

Audit finished EPUB 3 .epub publications offline combining EPUBCheck (5.4.0) structural validation with bounded, XXE-safe XML/ZIP EPUB Accessibility 1.1 checks (lxml.etree + Python zipfile). Verifies META-INF/container.xml and package.opf references, manifest resource existence, spine reading order, navigation document (nav) links and #fragment targets, schema:accessMode / accessibilityFeature / accessibilityHazard / accessibilitySummary metadata, document xml:lang/lang, and <img> alt attributes. Clearly separates structural validity, automated accessibility checks, and human accessibility evaluation.

Distinction from existing accessibility skills:

When to Use

Prerequisites

How It Works

1. Enforce bounded archive safety before reading members

  1. Inspect ZIP central directory via zipfile.ZipFile in memory without calling extractall().
  2. Reject path traversal (.., leading /, backslashes, NUL bytes), symlinks (S_ISLNK), excessive member counts (> 2000), or oversized compressed/uncompressed entries (> 16 MiB member / > 64 MiB total) as INVALID_INPUT / UNSAFE_ARCHIVE.

2. Run EPUBCheck and EPUB Accessibility 1.1 inspection separately

Run the local verification suite in EPUB accessibility audit harness:

  1. Structural & spec check (EPUBCheck 5.4.0 when run_epubcheck=True): Run java -jar epubcheck.jar <file.epub> --json <report.json> (45s timeout), handling missing report files, corrupt JSON, or subprocess/JVM failures gracefully without uncaught exceptions, to validate OCF mimetype, container.xml, package.opf version 3.0, manifest file existence, spine reading order, and nav links. The default is bounded Python-only inspection for untrusted .epub archives. Use it (run_epubcheck=False / inspect_epub_python_only) so the external Java JVM is never invoked; structural checks report structural_status="NOT_TESTED" (structural_valid=None, epubcheck_errors=None) distinctly from EPUBCheck pass/fail.
  2. Accessibility metadata (EPUB Accessibility 1.1 §2.2 spec vs. recommended vs. project policy): Parse package.opf with XXE-disabled lxml.etree.XMLParser(resolve_entities=False, no_network=True) while separating:
  1. Normalized navigation targets & fragment verification: Resolve <nav epub:type="toc"> <a href="..."> paths relative to the nav document directory (posixpath.normpath + percent-decoding so ../ch1.xhtml from EPUB/nav/toc.xhtml resolves to EPUB/ch1.xhtml), reject archive escapes, require nav targets to exist in both the ZIP archive and <manifest> (UNMANIFESTED_NAV_TARGET), and confirm #fragment IDs exist in target XHTML documents.

3. Preserve human-evaluation boundary

Always emit distinct sections in the audit output:

Examples

Run the self-contained verification suite in EPUB accessibility audit harness:

User request: "Audit release.epub for EPUB 3.3 structural errors, broken TOC #fragment links, and EPUB Accessibility 1.1 metadata."
Inputs: Synthetic or local finished .epub archive inspected via EPUBCheck 5.4.0 + bounded lxml XML checks.
Expected result: Valid accessible EPUB passes structural and automated a11y checks while flagging human review;
  missing nav target or fragment fails structural + nav checks; structurally valid EPUB lacking schema:access* or img alt
  passes EPUBCheck yet fails automated a11y audit.

Limitations

Safety and Side Effects

Sources and related skills