Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/edda

crates/nornir-docbook/assets/typst/column.typ

// ONE tall page at a fixed column width — the shape a web page wants.
//
// `report.typ` is a book: A4 sheets, a cover, an outline, page numbers, a
// running header. A README rendered that way arrives as a stack of paper with
// the text cut across the sheets. This template is the other shape: no cover,
// no TOC, no page furniture, `height: auto` so the whole document is a SINGLE
// page as tall as it needs to be, and a width the caller sets in points so the
// SVG can be scaled to whatever the reader actually has.
//
// Paged target only. The layout primitives here (`page`, `line`, `pad`) are
// exactly what typst's HTML target rejects — `web.typ` is that path.

#import sys: inputs

#let title = inputs.at("title", default: "")
#let body = inputs.at("body", default: "")
// Points, as a float. The caller measures a browser column; this template does
// not guess one.
#let width = inputs.at("width", default: 720.0)

#set document(title: title)
// The page ground. Absent = `white`, exactly as before; `"none"` = transparent, so
// the column sits on whatever page it is inlined into; anything else is a hex.
#let ground = inputs.at("ground", default: "white")
#let ground = if ground == "white" { white } else if ground == "none" { none } else { rgb(ground) }

#set page(width: width * 1pt, height: auto, margin: 24pt, fill: ground)
// Libertinus Serif and DejaVu Sans Mono are what `typst-assets` embeds, so a
// page renders identically on a laptop and on an appliance with no fonts
// installed. The trailing names are for a host that has more.
// `lang` (default "en") also names the CJK face: a caller that supplies a Noto
// CJK collection gets the JP / SC / KR drawing of a shared code point by the
// page's language, not by the collection's order. Absent faces are skipped.
#let lang = inputs.at("lang", default: "en")
#let cjk = if lang == "zh" { "Noto Serif CJK SC" } else if lang == "ko" { "Noto Serif CJK KR" } else { "Noto Serif CJK JP" }
#set text(
  font: ("Libertinus Serif", cjk, "DejaVu Serif", "Liberation Serif"),
  size: 11pt,
  fill: rgb("#16191d"),
  lang: lang,
)
#set par(leading: 0.62em, spacing: 1.15em, justify: false)
#show link: set text(fill: rgb("#0a58ca"))
#show heading: set block(above: 1.4em, below: 0.7em)
#show heading.where(level: 1): set text(size: 20pt)
#show heading.where(level: 2): set text(size: 15pt)
#show heading.where(level: 3): set text(size: 12.5pt)
#show raw: set text(font: ("DejaVu Sans Mono", "Liberation Mono"), size: 9.2pt)
#show raw.where(block: false): it => box(
  fill: rgb("#f2f2f4"), inset: (x: 3pt, y: 1pt), outset: (y: 2pt),
  radius: 2pt, it,
)
#show raw.where(block: true): it => block(
  fill: rgb("#f5f6f8"), inset: 9pt, radius: 3pt, width: 100%, it,
)
#set table(stroke: 0.4pt + rgb("#cfd4da"), inset: 6pt)
#show quote.where(block: true): set pad(left: 12pt)

#eval(body, mode: "markup")