Theme
The default renderer uses a handlebars template to render your typst source files and comes with a default theme included in the shiroa
binary.
Currently we have no much design on theme's html part. But you can still configure your book project like a regular typst project.
Things to note
Your book.typ
should at least provides a book-meta
, as Get Started shown.
1
#import "@preview/shiroa:0.2.2": *
2
#show: book
3
4
#book-meta(
5
title: "My Book"
6
summary: [
7
= My Book
8
]
9
)
1
#import "@preview/shiroa:0.2.2": *
2
#show: book
3
4
#book-meta(
5
title: "My Book"
6
summary: [
7
= My Book
8
]
9
)
To support specialized rendering for web pages and different page layouts, Your template.typ
can import and respect the page-width
and target
variable from @preview/shiroa:0.2.2
to this time.
1
#import "@preview/shiroa:0.2.2": page-width, target
2
3
#let project(body) = {
4
// set web/pdf page properties
5
set page(
6
width: page-width,
7
// for a website, we don't need pagination.
8
height: auto,
9
)
10
11
// remove margins for web target
12
set page(margin: (
13
// reserved beautiful top margin
14
top: 20pt,
15
// Typst is setting the page's bottom to the baseline of the last line of text. So bad :(.
16
bottom: 0.5em,
17
// remove rest margins.
18
rest: 0pt,
19
)) if target.starts-with("web");
20
21
body
22
}
1
#import "@preview/shiroa:0.2.2": page-width, target
2
3
#let project(body) = {
4
// set web/pdf page properties
5
set page(
6
width: page-width,
7
// for a website, we don't need pagination.
8
height: auto,
9
)
10
11
// remove margins for web target
12
set page(margin: (
13
// reserved beautiful top margin
14
top: 20pt,
15
// Typst is setting the page's bottom to the baseline of the last line of text. So bad :(.
16
bottom: 0.5em,
17
// remove rest margins.
18
rest: 0pt,
19
)) if target.starts-with("web");
20
21
body
22
}