shiroa

Theme

The default renderer uses a handlebars template to render your typst source files and comes with a default theme included in the shiroashiroa 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.typbook.typ should at least provides a book-metabook-meta, as Get Started shown.


                                
#import "@preview/shiroa:0.2.3": *

                                
#show: book

                                


                                
#book-meta(

                                
    title: "My Book"

                                
    summary: [

                                
      = My Book

                                
    ]

                                
)

                                
#import "@preview/shiroa:0.2.3": *

                                
#show: book

                                


                                
#book-meta(

                                
    title: "My Book"

                                
    summary: [

                                
      = My Book

                                
    ]

                                
)

                                
#import "@preview/shiroa:0.2.3": *

                                
#show: book

                                


                                
#book-meta(

                                
    title: "My Book"

                                
    summary: [

                                
      = My Book

                                
    ]

                                
)

                                
#import "@preview/shiroa:0.2.3": *

                                
#show: book

                                


                                
#book-meta(

                                
    title: "My Book"

                                
    summary: [

                                
      = My Book

                                
    ]

                                
)

To support specialized rendering for web pages and different page layouts, Your template.typtemplate.typ can import and respect the page-widthpage-width and targettarget variable from @preview/shiroa:0.2.3@preview/shiroa:0.2.3 to this time.


                                
#import "@preview/shiroa:0.2.3": page-width, target

                                


                                
#let project(body) = {

                                
  // set web/pdf page properties

                                
  set page(

                                
    width: page-width,

                                
    // for a website, we don't need pagination.

                                
    height: auto,

                                
  )

                                
  

                                
  // remove margins for web target

                                
  set page(margin: (

                                
    // reserved beautiful top margin

                                
    top: 20pt,

                                
    // Typst is setting the page's bottom to the baseline of the last line of text. So bad :(.

                                
    bottom: 0.5em,

                                
    // remove rest margins.

                                
    rest: 0pt,

                                
  )) if target.starts-with("web");

                                
  

                                
  body

                                
}

                                
#import "@preview/shiroa:0.2.3": page-width, target

                                


                                
#let project(body) = {

                                
  // set web/pdf page properties

                                
  set page(

                                
    width: page-width,

                                
    // for a website, we don't need pagination.

                                
    height: auto,

                                
  )

                                
  

                                
  // remove margins for web target

                                
  set page(margin: (

                                
    // reserved beautiful top margin

                                
    top: 20pt,

                                
    // Typst is setting the page's bottom to the baseline of the last line of text. So bad :(.

                                
    bottom: 0.5em,

                                
    // remove rest margins.

                                
    rest: 0pt,

                                
  )) if target.starts-with("web");

                                
  

                                
  body

                                
}

                                
#import "@preview/shiroa:0.2.3": page-width, target

                                


                                
#let project(body) = {

                                
  // set web/pdf page properties

                                
  set page(

                                
    width: page-width,

                                
    // for a website, we don't need pagination.

                                
    height: auto,

                                
  )

                                
  

                                
  // remove margins for web target

                                
  set page(margin: (

                                
    // reserved beautiful top margin

                                
    top: 20pt,

                                
    // Typst is setting the page's bottom to the baseline of the last line of text. So bad :(.

                                
    bottom: 0.5em,

                                
    // remove rest margins.

                                
    rest: 0pt,

                                
  )) if target.starts-with("web");

                                
  

                                
  body

                                
}

                                
#import "@preview/shiroa:0.2.3": page-width, target

                                


                                
#let project(body) = {

                                
  // set web/pdf page properties

                                
  set page(

                                
    width: page-width,

                                
    // for a website, we don't need pagination.

                                
    height: auto,

                                
  )

                                
  

                                
  // remove margins for web target

                                
  set page(margin: (

                                
    // reserved beautiful top margin

                                
    top: 20pt,

                                
    // Typst is setting the page's bottom to the baseline of the last line of text. So bad :(.

                                
    bottom: 0.5em,

                                
    // remove rest margins.

                                
    rest: 0pt,

                                
  )) if target.starts-with("web");

                                
  

                                
  body

                                
}