1. Introduction
  2. User Guide
  3. 1. Installation
  4. 2. Get Started
  5. 3. Frequently Asked Questions
  6. 4. Further reading
  7. Reference Guide
  8. 5. Command Line Tool
    1. 5.1. init
    2. 5.2. build
    3. 5.3. serve
    4. 5.4. clean
    5. 5.5. completions
  9. 6. Format
    1. 6.1. book.typ
      1. 6.1.1. Book Metadata
        1. 6.1.1.1. Draft chapter
      2. 6.1.2. Build Metadata
    2. 6.2. Theme
    3. 6.3. Typst Support
      1. 6.3.1. Cross Reference
        1. 6.3.1.1. Cross Reference Sample
      2. 6.3.2. Embed Sanitized HTML Elements
        1. 6.3.2.1. Multimedia components
      3. 6.3.3. Semantic Page Description
    4. 6.4. Rendering Tests
  10. 7. For developers
    1. 7.1. Typst-side APIs
    2. 7.2. shiroa CLI Internals
    3. 7.3. Alternative Backends

shiroa

#

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:


        
#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 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:


        
#build-meta(

        
  dest-dir: "../dist",

        
)

        
#build-meta(

        
  dest-dir: "../dist",

        
)

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.