A TypeScript-first Canvas-based EPUB rendering library.
Rito is an EPUB-focused rendering engine. It parses EPUB archives, resolves a book-oriented CSS subset, paginates chapters, and renders pages or spreads into Canvas.
The repository also includes:
@ritojs/core— the core parser/layout/rendering package@ritojs/kit— a framework-agnostic controller layer with transitions and overlays@ritojs/react— React hooks and components on top of the core packages
Warning
Rito is still under development! We do not recommend that you use it in production environments, but of course we always welcome your PR!
pnpm add @ritojs/coreimport { createReader } from '@ritojs/core';
const response = await fetch('book.epub');
const canvas = document.querySelector('canvas')!;
const reader = await createReader(await response.arrayBuffer(), canvas, {
width: 800,
height: 600,
margin: 40,
spread: 'double',
});
reader.renderSpread(0);
console.log(`${reader.totalSpreads} spreads, ${reader.toc.length} TOC entries`);
reader.dispose();- Documentation Index
- Getting Started
- Reader API
- Stable Primitives
- Advanced Entry
- Specialized Subpaths
- Capabilities
- Limitations
- Architecture
- Release & Versioning
- Release Runbook
- Using
@ritojs/kit - Using
@ritojs/react
Rito is optimized for EPUB book layout, not browser-equivalent web layout.
- EPUB-first rendering model
- small, stable public API on the main
@ritojs/coreentry - optional higher-level integration packages for controllers and React
- deliberate CSS/layout subset focused on book pagination
See the detailed scope in Capabilities and Limitations.
pnpm install
pnpm run check