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
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 Book API.
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§

FileSource
A ByteSource backed by a local file, using positioned reads (pread) so no seek state is shared between readers.

Traits§

ByteSource
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.