Skip to main content

Crate boko

Crate boko 

Source
Expand description

§boko

A high-performance, format-agnostic ebook processing engine.

§Architecture

Boko uses an Importer architecture for reading ebooks:

  • Book is the runtime handle that wraps format-specific backends
  • Importer trait defines the interface for format backends
  • Lazy loading via ByteSource for efficient random access

§Supported Formats

FormatReadWrite
EPUB
AZW3
MOBI-

§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 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 dom::compile_html;
pub use export::Azw3Exporter;
pub use export::EpubExporter;
pub use export::Exporter;
pub use export::MarkdownConfig;
pub use export::MarkdownExporter;
pub use import::ChapterId;
pub use import::Importer;
pub use import::SpineEntry;
pub use io::ByteSource;
pub use io::FileSource;

Modules§

dom
HTML to IR compiler pipeline.
epub
EPUB format support - pure parsing functions.
export
Export module for writing ebooks to various formats.
import
Format importers for reading ebook files.
io
IO Abstractions for random-access byte reading.
kfx
KFX (KF10) format reader and writer.
markdown
Pure markdown generation from IR.
mobi
MOBI/AZW3 format support.
model
Core data model for ebook processing.
style
Style system for CSS property types, computed styles, and cascade.