Expand description
§boko
A high-performance, format-agnostic ebook processing engine.
§Architecture
Boko uses an Importer architecture for reading ebooks:
Bookis the runtime handle that wraps format-specific backendsImportertrait defines the interface for format backends- Lazy loading via
ByteSourcefor efficient random access
§Supported Formats
| Format | Read | Write |
|---|---|---|
| KFX | ✓ | ✓ |
| AZW3 | ✓ | ✓ |
| EPUB | ✓ | ✓ |
| MOBI | ✓ | - |
| Markdown | - | ✓ |
§Quick Start
use boko::Book;
let mut book = Book::open("input.epub")?;
println!("Title: {}", book.metadata().title);
// Iterate chapters (collect spine first to avoid borrow issues)
let spine: Vec<_> = book.spine().to_vec();
for entry in spine {
let content = book.load_raw(entry.id)?;
println!("Chapter: {} bytes", content.len());
}Re-exports§
pub use error::Error;pub use error::Result;pub use model::Book;pub use model::Chapter;pub use model::ContentBlock;pub use model::Format;pub use model::Metadata;pub use model::Node;pub use model::NodeId;pub use model::Resource;pub use model::Role;pub use model::SectionNode;pub use model::SectionTree;pub use model::SemanticMap;pub use model::TextRange;pub use model::TocEntry;pub use model::extract_section_tree;pub use style::ComputedStyle;pub use style::ListStyleType;pub use style::Origin;pub use style::StyleId;pub use style::StylePool;pub use style::Stylesheet;pub use style::ToCss;pub use export::Azw3Config;pub use export::Azw3Exporter;pub use export::EpubConfig;pub use export::EpubExporter;pub use export::Exporter;pub use export::KfxExporter;pub use export::MarkdownConfig;pub use export::MarkdownExporter;pub use import::ChapterId;pub use import::Importer;pub use import::SpineEntry;
Modules§
- error
- Typed error handling for boko’s importers, exporters, and
BookAPI. - export
- Export module for writing ebooks to various formats.
- import
- Format importers for reading ebook files.
- model
- Core data model for ebook processing.
- optimize
- Book-level output optimization.
- style
- Style system for CSS property types, computed styles, and cascade.
Structs§
- File
Source - A
ByteSourcebacked by a local file, using positioned reads (pread) so no seek state is shared between readers.
Traits§
- Byte
Source - A thread-safe, random-access source of bytes. Allows multiple threads to read different parts of the source simultaneously.
Functions§
- compile_
html - Compile HTML content to IR.