Test Page (Gen 2) - Semantic Page Description
Note: This main file must be named book.typ
.
The book.typ
consists of many meta sections describing your book project. If you are familiar with mdbook
, the book.typ
file is similar to the book.toml
with summary.md
file.
The main file is used by shiroa
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.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.summary
metadata from book.typ
.
book-meta
Specify general metadata of the book project. For example:
1
#book-meta(
2
title: "shiroa",
3
authors: ("Myriad-Dreamin", "7mile"),
4
summary: [ // this field works like summary.md of mdbook
5
#prefix-chapter("pre.typ")[Prefix Chapter]
6
= User Guide
7
- #chapter("1.typ", section: "1")[First Chapter]
8
- #chapter("1.1.typ", section: "1.1")[First sub]
9
- #chapter("2.typ", section: "1")[Second Chapter]
10
#suffix-chapter("suf.typ")[Suffix Chapter]
11
]
12
)
1
#book-meta(
2
title: "shiroa",
3
authors: ("Myriad-Dreamin", "7mile"),
4
summary: [ // this field works like summary.md of mdbook
5
#prefix-chapter("pre.typ")[Prefix Chapter]
6
= User Guide
7
- #chapter("1.typ", section: "1")[First Chapter]
8
- #chapter("1.1.typ", section: "1.1")[First sub]
9
- #chapter("2.typ", section: "1")[Second Chapter]
10
#suffix-chapter("suf.typ")[Suffix Chapter]
11
]
12
)
In this example, you specify following fields for the book project:
- title
string
(optional): Specify the title of the book. - authors
array<string>
(optional): Specify the author(s) of the book. - summary
content
(required): Summarize of the book.
See Book Metadata for more details.
build-meta
Specify build metadata of the book project. For example:
1
#build-meta(
2
dest-dir: "../dist",
3
)
1
#build-meta(
2
dest-dir: "../dist",
3
)
When you set build-meta.dest-dir
to ../dist
, shiroa
will output the generated content to parent/to/book.typ/../../dist
or parent/dist
.
See Build Metadata for more details.