ebook-rs 0.3.1

Pure Rust EPUB parser and reader engine with CFI location mapping, full-text search, font de-obfuscation, and WASM/HTTP reader support.
Documentation
# πŸ“– EBook-RS: Multi-Format Rust EBook Parser and Reader Engine (v0.3.0)

`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)**, and **CBZ (Comic Book ZIP)** formats, designed for full feature parity with **epub.js** and **foliate-js**.

---

## ⚑ Feature Parity Matrix

| Feature | πŸš€ `ebook-rs` (v0.3.0) | πŸ“¦ `epub.js` | πŸ“– `foliate-js` | πŸ¦€ `rbook` |
|---|:---:|:---:|:---:|:---:|
| **EPUB 2 & 3 Support** | βœ… Yes | βœ… Yes | βœ… Yes | βœ… Yes |
| **MOBI & AZW3 Support** | βœ… Native PalmDOC LZ77 | ❌ No | βœ… Yes | ❌ No |
| **FB2 (FictionBook 2) Support** | βœ… Native XML | ❌ No | βœ… Yes | ❌ No |
| **KEPUB & LIT Support** | βœ… Native | ❌ No | βœ… Yes | ❌ No |
| **CBZ Comic Archive Support** | βœ… Native ZIP Images | ❌ No | βœ… Yes | ❌ No |
| **CBR Comic Archive Detection** | ℹ️ Pure-Rust Error Guidance | ❌ No | βœ… Yes (libarchive) | ❌ No |
| **Full-Text Search Engine** | βœ… 0.59ms / 0-alloc | ❌ Third-party | βœ… Yes | ❌ No |
| **EPUB Canonical Fragment Identifiers (CFI)** | βœ… Complete IDPF Spec | βœ… Yes | βœ… Yes | ❌ No |
| **Locations & Progress Indexing** | βœ… Discrete Chunks | ⚠️ Slow (DOM) | βœ… Yes | ❌ No |
| **Font De-Obfuscation (IDPF & Adobe)** | βœ… Native SHA-1/XOR | ❌ No | βœ… Yes | ❌ No |
| **Pre-Display Transformation Hooks** | βœ… Pipeline Hooks | ❌ No | βœ… Yes | ❌ No |
| **EPUB 3 Landmarks & Page-List** | βœ… Full Parser | βœ… Yes | βœ… Yes | ❌ No |
| **Base64 Asset Inlining** | βœ… Auto Images/Fonts/CSS | ❌ Blob URIs | ❌ Blob URIs | ❌ No |
| **WebAssembly Browser Support** | βœ… `wasm-bindgen` | ❌ JS Only | ❌ JS Only | ❌ No |
| **Embedded HTTP Reader App** | βœ… Built-in Server | ❌ No | ❌ No | ❌ No |
| **Double-Spread & Continuous Scroll** | βœ… CSS Column / Vertical | βœ… Yes | βœ… Yes | ❌ No |
| **Readium Webpub Manifest Export** | βœ… `to_webpub_manifest` | ❌ No | βœ… Yes | ❌ No |

---

## πŸ—ΊοΈ Project Roadmap

- [x] **v0.1.0**: Core EPUB 2/3 parser, CFI Engine, Location Progress, Annotations, Web UI Server, WASM Bindings.
- [x] **v0.2.0**: Native Multi-Format Support (**MOBI**, **AZW3**, **FB2**, **KEPUB**, **LIT**), IDPF & Adobe Font De-obfuscation, EPUB 3 Landmarks & Page List, Pre-Display Transformation Hooks.
- [x] **v0.2.5**: Readium Webpub Manifest Export (`application/webpub+json`), PalmDOC LZ77 distance fallback, FB2 image reference matching fix, complex CFI range assertion safety.
- [x] **v0.3.0**: **CBZ (Comic Book Archive)** zero-copy base64 image renderer, format auto-detection guard, pure Rust CBR error guidance.

---

## πŸš€ Quick Start Example

```rust
use ebook_rs::Book;

fn main() -> Result<(), String> {
    // Auto-detects and opens EPUB, MOBI, AZW3, FB2, KEPUB, LIT, or CBZ files
    let mut book = Book::from_file("comic.cbz")?;

    println!("Title: {}", book.metadata().title);
    println!("Sections/Pages: {}", book.spine().len());

    // Retrieve processed HTML page with embedded base64 images
    let page1 = book.get_section(0)?;
    println!("HTML: {}", page1.processed_html);

    Ok(())
}
```

---

## πŸ“œ License

Licensed under the MIT License.