Spines
A spine in Rheo is the backbone or ‘table of contents’ of Typst source files that should be compiled to an output format. It takes its name from the EPUB specification, in which the spine articulates—or reticulates— the set and order of chapters included.
Directory-scan default
With no configuration at all, the spine is built from content_dir’s own directory structure:
- Every
.typfile is included, ordered alphabetically within each directory level. - A subdirectory with a landing file —
index.typ, or a file named after the directory itself (e.g.chapters/chapters.typ) — becomes a group with its own page and handle. - A subdirectory without a landing file becomes a group node with no page or handle of its own, its title derived from the directory name.
- A leading numeric prefix on a directory or section name orders it among its siblings but is stripped from the displayed title:
01-intro/→ “Intro”. The raw name, prefix included, is kept in the handle. Files are not prettified this way — a file’s title comes from its own content, not its filename.
This default is enough for most projects: name your files and folders in the order you want them read, and the spine follows.
[spine] exclude
To omit files or folders from the scan without moving them out of content_dir, list glob patterns (relative to content_dir) under [spine] exclude:
[spine]
exclude = ["drafts/**", "TODO.typ"]Excluded paths are dropped from every format’s spine.
[[spine.section]]
[[spine.section]] groups matched files under a virtual directory, without moving them on disk. This is useful for reshaping the spine’s structure independently of your folder layout:
[[spine.section]]
name = "chapters"
include = ["ch-*.typ"]- Files matching
includeget pulled under a virtualchaptersgroup, gaining a namespaced handle exactly as if they lived in achapters/directory:ch-1.typ→<chapters:ch-1>. - A section’s
titledefaults to a prettified version ofname, and can be overridden explicitly. - Sections nest via
[[spine.section.section]]to arbitrary depth. - When
includelists more than one glob, matches are gathered in glob order and lexicographically within each glob — so listing globs in the order you want lets you control ordering explicitly, not just alphabetically.
Per-format overrides
A format-specific table — [pdf.spine], [html.spine], [epub.spine] — overrides the global [spine] table field by field: any field the per-format table sets replaces the matching global field, and any field it leaves unset still falls back to the global [spine].
[spine]
exclude = ["drafts/**"]
[pdf.spine]
title = "My Book" # combined-output title, PDF/EPUB onlyHere PDF still inherits the global exclude, even though it only sets its own title.
Each format uses its spine slightly differently. See the PDF, HTML, and EPUB format pages for details on how spines are configured and what defaults are applied for each output.