Typst Supports - Semantic Page Description
The book.typbook.typ consists of many meta sections describing your book project. If you are familiar with mdbookmdbook, the book.typbook.typ file is similar to the book.tomlbook.toml with summary.mdsummary.md file.
The main file is used by shiroashiroa to know what chapters to include, in what order they should appear, what their hierarchy is and where the source files are. Without this file, there is no book.
Since the book.typbook.typ is merely a typst source file, you can import them everywhere, which could be quite useful. For example, to export project to a single PDF file, an ebook file can aggregate all source files of this project according to the imported book-meta.summarybook-meta.summary metadata from book.typbook.typ.
Specify general metadata of the book project. For example:
#book-meta( title: "shiroa", authors: ("Myriad-Dreamin", "7mile"), summary: [ // this field works like summary.md of mdbook #prefix-chapter("pre.typ")[Prefix Chapter] = User Guide - #chapter("1.typ", section: "1")[First Chapter] - #chapter("1.1.typ", section: "1.1")[First sub] - #chapter("2.typ", section: "1")[Second Chapter] #suffix-chapter("suf.typ")[Suffix Chapter] ])
#book-meta( title: "shiroa", authors: ("Myriad-Dreamin", "7mile"), summary: [ // this field works like summary.md of mdbook #prefix-chapter("pre.typ")[Prefix Chapter] = User Guide - #chapter("1.typ", section: "1")[First Chapter] - #chapter("1.1.typ", section: "1.1")[First sub] - #chapter("2.typ", section: "1")[Second Chapter] #suffix-chapter("suf.typ")[Suffix Chapter] ])
In this example, you specify following fields for the book project:
- title
stringstring(optional): Specify the title of the book. - authors
array<string>array<string>(optional): Specify the author(s) of the book. - summary
contentcontent(required): Summarize of the book.
See Book Metadata for more details.
Specify build metadata of the book project. For example:
#build-meta( dest-dir: "../dist",)
#build-meta( dest-dir: "../dist",)
When you set build-meta.dest-dirbuild-meta.dest-dir to ../dist../dist, shiroashiroa will output the generated content to parent/to/book.typ/../../distparent/to/book.typ/../../dist or parent/distparent/dist.
See Build Metadata for more details.