From 77a7830ed584648b35c516e064ba1dcd7a8866d7 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 16 Sep 2026 17:41:09 +0200 Subject: [PATCH] Justify report prose while preserving card spacing --- docs/report-contract.md | 1 + templates/report.typ | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/report-contract.md b/docs/report-contract.md index b98c709..dafd0d4 100644 --- a/docs/report-contract.md +++ b/docs/report-contract.md @@ -39,6 +39,7 @@ I/O failure, and 2 for invalid invocation. Typst 0.15+ and selected fonts are runtime dependencies. Python, PyYAML, and jsonschema are test-only dependencies. PDF bytes can vary with Typst and font versions; record them when historical reproduction matters. +Report body paragraphs are justified; cards and code blocks stay left aligned. ## Required and optional content diff --git a/templates/report.typ b/templates/report.typ index 518404c..bfe4400 100644 --- a/templates/report.typ +++ b/templates/report.typ @@ -59,7 +59,8 @@ else if kind == "callout" { callout([#as-text(get(item, "text", default: ""))], kind: get(item, "kind", default: "info"), title: get(item, "title", default: none)) } else if kind == "code" { block(width: 100%, inset: 7pt, fill: soft, - stroke: 0.5pt + line-color)[#text(font: get(theme, "mono_font", default: "DejaVu Sans Mono"), + stroke: 0.5pt + line-color)[#set par(justify: false) + #text(font: get(theme, "mono_font", default: "DejaVu Sans Mono"), size: 8pt)[#as-text(get(item, "text", default: ""))]] } else if kind == "subsection" { block(above: 5pt, below: 3pt)[#text(weight: "bold", fill: ink)[#as-text(get(item, "title", default: ""))]] @@ -71,6 +72,7 @@ let background = if tone == none { soft } else { border.lighten(93%) } block(width: 100%, inset: 9pt, radius: 3pt, below: 6pt, fill: background, stroke: 0.6pt + border)[ + #set par(justify: false) #text(weight: "bold", fill: if tone == none { accent } else { border })[#as-text(item.title)] #parbreak() #for child in item.content { render-block(child); v(3pt) } @@ -90,7 +92,7 @@ text(size: 7pt, fill: muted)[#if "id" in report { [Report #as-text(report.id)] }], text(size: 7pt, fill: muted)[Page #counter(page).display()])) #set text(font: get(theme, "font", default: "DejaVu Sans"), size: 9.5pt, fill: ink) -#set par(leading: 0.58em, spacing: 0.55em) +#set par(leading: 0.58em, spacing: 0.55em, justify: true) #show raw.where(block: false): box.with( fill: soft, stroke: 0.5pt + line-color, radius: 3pt, inset: (x: 4pt, y: 1pt), outset: (y: 1pt),