Skip to content

Ringyuki/Rito

Repository files navigation

Rito

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!

Install

pnpm add @ritojs/core

Quick Start

import { 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

Release Scope

Rito is optimized for EPUB book layout, not browser-equivalent web layout.

  • EPUB-first rendering model
  • small, stable public API on the main @ritojs/core entry
  • 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.

Development

pnpm install
pnpm run check

About

A TypeScript-first Canvas-based EPUB rendering library.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages