Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Backend

Spectra’s pure lowering from presentation values to Typst documents.

Generic syntax construction and escaping belong to the independent Typst package. This module contains only presentation-specific mapping decisions: a Pict in, Typst source out, at a chosen reveal stage under a theme.

fn main() = println(render_pict(item("Lowered by the backend."), 0, prism_theme))
align(left,
  text(size: 21pt,
    fill: rgb("#211a2c"))[#(text(fill: rgb("#6d28d9"))[#(text("→ "))] + text("Lowered by the backend."))])

Types

TypstDocument

type TypstDocument = TypstDocument {
  format: String,
  source: String,
  logical_slides: Int,
  physical_pages: Int,
  assets: List(String)
} deriving (Eq, Show)

Functions and Values

max_stage

max_stage : (Layout.Pict) -> Int

Highest reveal stage mentioned by a pict tree.

pict_assets

pict_assets : (Layout.Pict) -> List(String)

Logical, project-relative asset names reached by a pict tree.

render_pict

render_pict : (Layout.Pict, Int, Theme.Theme) -> String

Render a pict for one concrete reveal stage.

render_slide_page

render_slide_page : (Option(String), Layout.Pict, Int, Theme.Theme) -> String

Render one physical page from a logical slide and reveal stage.

typst_prelude

typst_prelude : (Theme.Theme) -> String

The small presentation runtime prepended to every generated document.