Rheo: A Unified Typesetting Engine for Print, Web, and E-Books
#Rust

Rheo: A Unified Typesetting Engine for Print, Web, and E-Books

Tech Essays Reporter
3 min read

A new open-source CLI tool called Rheo compiles Typst documents into PDF, HTML, and EPUB simultaneously, offering a streamlined workflow for multi-format publishing with a built-in development server and automatic link transformation.

The fragmentation of document creation tools often forces writers and developers to maintain separate workflows for print, web, and digital book formats. Rheo, a new typesetting and static site engine based on the Typst markup language, aims to bridge this gap by compiling a single source document into PDF, HTML, and EPUB outputs simultaneously. This approach addresses a fundamental inefficiency in technical documentation and publishing, where content is frequently duplicated or manually adapted across formats, leading to version drift and increased maintenance overhead.

Rheo operates as a standalone CLI tool, leveraging the Rust ecosystem for performance and reliability. Its core premise is that a well-structured Typst document can be the single source of truth for multiple output formats. The tool automatically handles format-specific transformations, such as converting internal cross-references. For instance, a link like #link("./about.typ")[about page] is compiled to ./about.html in the HTML output and a corresponding page reference in the PDF, ensuring functional navigation regardless of the final medium. This eliminates the need for conditional logic or manual link adjustments, a common pain point in multi-format publishing.

Featured image

The workflow is designed for both batch processing and iterative development. The watch mode monitors a directory for file changes and triggers recompilation automatically. When paired with the --open flag, it launches a local development server at http://localhost:3000 with automatic browser refresh, providing a live preview environment for HTML output. This server is particularly valuable for web content creation, as it mimics a static site generator's development experience while maintaining the connection to the source Typst files.

Beyond simple compilation, Rheo supports sophisticated document assembly through its spine configuration. Users can merge multiple Typst files into a single PDF or EPUB by defining a spine in a rheo.toml configuration file. The vertebrae field accepts glob patterns to specify which files to include and their order, using lexicographic sorting for consistent output. This feature is essential for book-length projects, technical manuals, or any publication requiring a cohesive multi-chapter structure. The configuration system itself is flexible; while flags can be used for one-off commands, a project-level rheo.toml file centralizes settings like custom build directories or format-specific options.

Installation is straightforward for users familiar with Rust's toolchain. The recommended method is via Cargo, the Rust package manager, which pulls the latest version from crates.io. For those who prefer building from source or need a reproducible environment, Rheo provides a Nix flake, enabling a consistent development and compilation setup across different systems. This dual installation path caters to both casual users and developers who value environment reproducibility.

The project's feature set reveals a thoughtful consideration of real-world publishing needs. Automatic defaults for EPUB generation, such as deriving titles from filenames and including all .typ files in a directory, lower the barrier to entry for creating e-books. Simultaneously, the ability to specify a custom CSS file for HTML output allows for deep stylistic control, ensuring that the web output aligns with specific branding or design requirements. The licensing under Apache 2.0 and MIT provides permissive terms for both commercial and open-source use, encouraging adoption and contribution.

Project header

Rheo represents a convergence of several trends: the growing adoption of Typst as a modern alternative to LaTeX, the demand for unified content pipelines, and the efficiency of Rust-based tooling. By abstracting the complexities of multi-format compilation, it allows authors to focus on content rather than toolchain management. For technical writers, academic researchers, and developers maintaining documentation, Rheo offers a compelling path to reduce duplication and ensure consistency across print, web, and e-book formats. Its open-source nature and active development, as seen on its GitHub repository, suggest a tool that will evolve with community input, potentially expanding its format support and integration capabilities in the future.

Comments

Loading comments...