From 9ad4d38746dfacdf4921949e1c8bd050a0817cc7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 00:04:08 -0300 Subject: The book and the HTML gain "Setting up your environment" after the guide chapters lists setup.typ second and #doc takes a setup id. Shell lines (#cmd) follow the density too: roomy in the book and the HTML, with a tint and space around them, tight on the A4 sheet; the book sets code blocks on the same tint. Co-Authored-By: Claude Opus 5.5 --- docs/typ/style.typ | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'docs/typ/style.typ') diff --git a/docs/typ/style.typ b/docs/typ/style.typ index e1bab27d..cf55ae86 100644 --- a/docs/typ/style.typ +++ b/docs/typ/style.typ @@ -27,6 +27,7 @@ /// keep working. #let topics = ( guide: ("guide", none), + setup: ("setup", none), cheatsheet: ("cheatsheet", none), scripting: ("scripting", none), reference: ("reference", none), @@ -50,6 +51,7 @@ /// `ch-`. #let chapters = ( (id: "guide", title: "Guide", file: "guide.typ"), + (id: "setup", title: "Setting up your environment", file: "setup.typ"), (id: "cheatsheet", title: "Cheatsheet", file: "cheatsheet.typ"), (id: "scripting", title: "Scripting", file: "scripting.typ"), (id: "reference", title: "Reference", file: "reference.typ"), @@ -60,6 +62,10 @@ /// The tutor, shown as it is in the editor (`Tutor`), from the repo root. #let tutor-path = "/src/tutor.txt" +/// How much room tables and shell lines get: "roomy" (the book, the HTML) +/// or "tight" (the A4 sheet sets it). +#let density = state("density", "roomy") + #let html-out() = target() == "html" #let span(class, body) = html.elem("span", attrs: (class: class), body) #let m(s, fill: palette.ink) = text(font: mono, size: 0.92em, fill: fill, s) @@ -159,9 +165,12 @@ /// A shell line. #let cmd(c) = context if html-out() { raw(c, block: true, lang: "sh") } else { + let tight = density.get() == "tight" block( - width: 100%, inset: (left: 3pt, y: 1.2pt), spacing: 0.4em, - stroke: (left: 1pt + palette.rule), + width: 100%, spacing: if tight { 0.4em } else { 0.9em }, + inset: if tight { (left: 3pt, y: 1.2pt) } else { (left: 6pt, y: 3pt) }, + stroke: (left: (if tight { 1pt } else { 1.5pt }) + palette.rule), + fill: if tight { none } else { palette.tag-bg.transparentize(50%) }, text(font: mono, size: 0.85em, fill: palette.ink, c), ) } @@ -187,17 +196,13 @@ } } -/// How roomy #pairs tables are: "roomy" (the book, the HTML) or "tight" -/// (the A4 sheet sets it). -#let pairs-density = state("pairs-density", "roomy") - /// Pairs: a thing and what it means, as a two-column table, key column /// first, rows on alternating tints. `split: 2` sets the rows as that many /// tables side by side (on paper; HTML gets one table). #let pairs(split: 1, ..cells) = { let rows = cells.pos().chunks(2) context { - let tight = pairs-density.get() == "tight" + let tight = density.get() == "tight" let one(rows) = table( columns: (auto, 1fr), stroke: none, inset: if tight { (x: 2pt, y: 1.6pt) } else { (x: 7pt, y: 4pt) }, -- cgit v1.3