ebook-rs 0.11.6

Pure Rust multi-format eBook engine (EPUB2/3, MOBI, AZW3, FB2, LIT, CBZ, PDF, ODT, TXT, MD) with SpeechSynthesis TTS Word Synchronizer, Legacy Charset Decoding, Auto Language Detection, Zstd State Caching, Universal EPUB3 Exporter, Zero-Copy mmap, and Readium LCP/Locator APIs.
Documentation

šŸ“– EBook-RS: Multi-Format Rust EBook Parser and Reader Engine (v0.11.5)

ebook-rs is a high-performance, 100% pure Rust parser and reader engine for EPUB 2, EPUB 3, MOBI, AZW3 (KF8), FB2 (FictionBook 2), KEPUB (Kobo EPUB), LIT (Microsoft Reader), CBZ (Comic Book ZIP), PDF, ODT, TXT, and MD formats, designed for full feature parity with epub.js and foliate-js.


⚔ Feature Parity Matrix

šŸ“‚ Format Support

Feature šŸš€ ebook-rs (v0.11.5) šŸ“¦ epub.js šŸ“– foliate-js šŸ¦€ rbook
EPUB 2 & 3 Support āœ… Full OPF + NCX/NAV āœ… Yes āœ… Yes āœ… Yes
EPUB 3 Fixed-Layout (FXL) āœ… 2-page spread renderer āœ… Yes āœ… Yes āŒ No
MOBI & AZW3 (KF8) Support āœ… Native PalmDOC LZ77 āŒ No āœ… Yes āŒ No
FB2 (FictionBook 2) Support āœ… Native XML + xlink:href āŒ No āœ… Yes āŒ No
KEPUB (Kobo EPUB) Support āœ… Native āŒ No āœ… Yes āŒ No
LIT (Microsoft Reader) Support āœ… Native āŒ No āœ… Yes āŒ No
CBZ (Comic Book ZIP) Support āœ… Native ZIP Images āŒ No āœ… Yes āŒ No
PDF Support āœ… pdf_oxide parser āŒ No āŒ No āŒ No
ODT (OpenDocument Text) āœ… office_oxide āŒ No āŒ No āŒ No
TXT / Markdown Support āœ… Auto-reflow sections āŒ No āŒ No āŒ No
Auto Format Detection āœ… Magic-byte detection āŒ No āŒ No āŒ No

🧭 Navigation & Rendering

Feature šŸš€ ebook-rs (v0.11.5) šŸ“¦ epub.js šŸ“– foliate-js šŸ¦€ rbook
IDPF CFI Engine āœ… Parse / format / compare / range āœ… Yes āœ… Yes āœ… Yes
CFI DOM Resolver āœ… cfi.resolve_dom_path(html) āœ… Yes āœ… Yes āŒ No
Readium CFI Unified Locator āœ… Full model āœ… Yes āœ… Yes āŒ No
Location / Reading Progress āœ… locations_from_sections() āœ… Yes āœ… Yes āœ… Yes
SMIL Media Overlays (Sync) āœ… NPT clock parser āœ… Yes āœ… Yes āŒ No
EPUB NCX / NAV TOC Parsing āœ… Deep recursive nav tree āœ… Yes āœ… Yes āœ… Yes
RTL Text Auto-Injection āœ… dir="rtl" + text-align:right āœ… Yes āœ… Yes āŒ No
Viewport Meta Parsing āœ… Zero-alloc slice parse āœ… Yes āœ… Yes āŒ No
Reflow Paginator āœ… ReflowPaginator::paginate_section āœ… Yes āœ… Yes āŒ No
Custom Font Injection āœ… @font-face CSS injection āœ… Yes āœ… Yes āŒ No

šŸ” Search & Analytics

Feature šŸš€ ebook-rs (v0.11.5) šŸ“¦ epub.js šŸ“– foliate-js šŸ¦€ rbook
Full-Text Search āœ… SIMD-accelerated āŒ No āœ… Basic āŒ No
Regex Search āœ… regex_search āŒ No āŒ No āŒ No
Search Context Snippets āœ… <mark> highlights + offsets āŒ No āœ… Yes āŒ No
Readium Search JSON Export āœ… Readium-compliant JSON āŒ No āœ… Yes āŒ No
NLP Reading Analytics āœ… Word count / reading time / complexity āŒ No āŒ No āŒ No
Auto Language Detection āœ… detect_language (whatlang) āŒ No āŒ No āŒ No

šŸ“ Annotations & Standards

Feature šŸš€ ebook-rs (v0.11.5) šŸ“¦ epub.js šŸ“– foliate-js šŸ¦€ rbook
W3C Web Annotation (JSON-LD) āœ… Full CRUD + to_w3c_json āŒ No āœ… Yes āŒ No
Readium WebPub Manifest Export āœ… book.to_webpub_manifest() āŒ No āœ… Yes āŒ No
OPDS 1.2 Atom XML Catalog āœ… OpdsFeed::parse_atom_xml āŒ No āŒ No āŒ No
OPDS 2.0 JSON Catalog āœ… OpdsFeed::parse_json āŒ No āŒ No āŒ No
Readium LCP DRM Detection āœ… License parse + expiry āŒ No āœ… Yes āŒ No
MLA / Chicago Citations āœ… book.to_mla_citation() āŒ No āŒ No āŒ No

āš™ļø Performance & Architecture

Feature šŸš€ ebook-rs (v0.11.5) šŸ“¦ epub.js šŸ“– foliate-js šŸ¦€ rbook
Zero-Copy Memory-Mapped I/O āœ… Book::from_mmap āŒ No āŒ No āŒ No
Zstd Compressed State Cache āœ… export_zstd_cache āŒ No āŒ No āŒ No
O(1) Archive Asset Lookup āœ… Dual-HashMap ZIP index āŒ No āŒ No āŒ No
SIMD UTF-8 Validation āœ… simdutf8 (AVX2/NEON) āŒ No āŒ No āŒ No
SIMD Substring Search āœ… memchr SIMD scanning āŒ No āŒ No āŒ No
AHash Fast Hash Maps āœ… 3–5Ɨ faster lookups āŒ No āŒ No āŒ No
Single-Pass CSS Inliner āœ… O(N) streaming builder āŒ No āŒ No āŒ No
Async Non-Blocking Web Font āœ… media="print" onload āœ… Yes āœ… Yes āŒ No
Built-in Localhost Reader āœ… tiny_http web server āœ… Yes āœ… Yes āŒ No

šŸ›”ļø Security & Robustness

Feature šŸš€ ebook-rs (v0.11.5) šŸ“¦ epub.js šŸ“– foliate-js šŸ¦€ rbook
Script Sanitizer (XSS Guard) āœ… 3-phase + entity decode āœ… Partial āœ… Partial āŒ No
Fuzzy Malformed XML Recovery āœ… Entity repair + tag heal āŒ No āŒ No āŒ No
Legacy Charset Decoding āœ… decode_bytes_with_encoding (encoding_rs) āŒ No āŒ No āŒ No
DRM-Protected Book Detection āœ… ADEPT + LCP detection āŒ No āœ… Yes āŒ No
HTTP Security Headers āœ… CSP / nosniff / SAMEORIGIN āŒ No āŒ No āŒ No
CBR RAR Format Error Guard āœ… RAR v4 + v5 magic detection āŒ No āŒ No āŒ No

🧩 Advanced & Developer Features

Feature šŸš€ ebook-rs (v0.11.5) šŸ“¦ epub.js šŸ“– foliate-js šŸ¦€ rbook
Universal EPUB 3 Exporter āœ… Any format → EPUB3 bytes āŒ No āŒ No āŒ No
Book Fingerprint / Identity āœ… SHA-based fingerprint āŒ No āŒ No āŒ No
SpeechSynthesis TTS Tokens āœ… get_tts_tokens with char offsets āŒ No āœ… Yes āŒ No
TTS Annotated HTML āœ… <span class="tts-word"> injection āŒ No āœ… Yes āŒ No
TreeSitter Code Highlighter āœ… AST extraction āŒ No āŒ No āŒ No
Lightweight DOM AST Engine āœ… EbookDomTree / DomNode āŒ No āŒ No āŒ No
EPUB Structural Validator āœ… OPF + Spine + Manifest checks āŒ No āŒ No āŒ No
WASM-Ready (no_std compat) āœ… WASM build support āœ… Yes āœ… Yes āŒ No

šŸ†• What's New in v0.11.5

  • Full Blackbox Test Suite (38 tests, 4.4 s) — Complete coverage across all features: OPDS, charset decoding, EPUB3 exporter roundtrip, reflow paginator, mmap, fuzzy XML, and TTS word synchronization.
  • O(1) Archive Lookups — Archive::contains now uses dual-HashMap constant-time lookups instead of O(N) linear scan.
  • Zero-Alloc Viewport Parsing — parse_viewport_meta rewritten with zero-copy byte slices.
  • Single-Pass CSS Inliner — O(N²) .replace() loops replaced with streaming O(N) builder.
  • Zstd Cache Deduplication — export_zstd_cache deduplicates identical processed_html / raw_html entries, reducing cache size by up to 50%.
  • Non-Blocking Font Loading — Localhost reader now uses async media="print" onload font loading with instant system font fallbacks, eliminating render-blocking delays.

šŸš€ Quick Start Example

use ebook_rs::{Book, ReflowPaginator, Cfi};

fn main() -> Result<(), String> {
    // Auto-detects and opens EPUB, MOBI, AZW3, FB2, KEPUB, LIT, CBZ, PDF, ODT, TXT, MD
    let mut book = Book::from_file("book.epub")?;

    println!("Title: {}", book.metadata().title);
    println!("Language: {:?}", book.detect_language());
    println!("Sections: {}", book.spine().len());

    // Export any format to standard binary EPUB3 ZIP bytes
    let epub3_bytes = book.export_epub3_bytes()?;

    // Zstd-compress parsed state for instant restoration
    let cache = book.export_zstd_cache()?;
    let restored = Book::from_zstd_cache(&cache)?;

    // Search with surrounding context snippets and <mark> highlights
    let search_results = book.search("quantum");
    for res in search_results {
        println!("Snippet: {}", res.snippet);
    }

    // TTS word-by-word synchronization tokens
    let tts_tokens = book.get_tts_tokens(0);
    for token in tts_tokens {
        println!("[{}..{}] {}", token.char_start, token.char_end, token.word);
    }

    Ok(())
}

šŸ“– Documentation & Wiki

Detailed API documentation and integration guides are available in docs/API.md and WIKI.md.


šŸ“œ License

Licensed under the MIT License. Copyright (c) 2026 SV-Stark.