termbook

EPUB reader for the terminal with syntax highlighting and image rendering

termbook Screenshot

About

termbook is a terminal-based EPUB reader that renders styled text, syntax-highlighted code blocks, and images directly in your terminal. Navigate by scrolling, page turns, or chapter jumps. Search across the entire book, bookmark passages, and switch color schemes.

Built as a curses UI with integrated pygments syntax highlighting, PIL image rendering, and support for fabulous block graphics on systems without Sixel.

Features

  • EPUB parsing: Full ZIP-based EPUB extraction, OPF/NCX metadata, and chapter content handling.
  • Text rendering: Formatted text spans (bold, italic, underline), HTML to terminal conversion, justified layout.
  • Syntax highlighting: Pygments-powered code block rendering with 20+ language support.
  • Image display: Multiple backends—PIL for quality, fabulous for compatibility, quarter-block fallback.
  • Navigation: Scroll, page, chapter navigation; full-book search; chapter table of contents.
  • Bookmarks: Save and jump to bookmarked lines within the book.
  • Color control: Switch between dark and light color schemes on supported terminals.
  • Input handling: Responsive keyboard control with count prefixes for jumps (e.g., 5k to scroll up 5 lines).

Installation

termbook is available as a Flatpak with one-click URL install and a hosted package repository, or can be built from source.

Flatpak (Recommended)

Install from the hosted Flatpak repository:

Install termbook via Flatpak

Or install from command line:

flatpak install --user --from \
  https://termbook.dev/dev.termbook.Termbook.flatpakref

App ID: dev.termbook.Termbook

Repository: termbook.flatpakrepo

From Source

Requires Python 3.10+, Pillow, pygments, fabulous:

git clone https://github.com/macsplit/termbook.git
cd termbook
make install-local
termbook path/to/book.epub

See README for full requirements.

Usage

Launch termbook with an EPUB file:

termbook book.epub

Navigation: Up/Down arrow to scroll, Page Up/Page Down to jump pages, n/p for next/previous chapter, Home/End to jump to start/end of chapter, t for table of contents, ? for help.

Search: Press / to search within the book. Bookmarks: s to save, b to choose bookmark. URLs: u to open, i for images. Colors: c to toggle color scheme (if supported).

Source & Attribution

termbook is open source and actively developed on GitHub. Released under the MIT License.

termbook builds upon epr by Benawi Adha, adapted and extended with modern parsing, rendering, and UI improvements.