Style inline raw text as compact pills

This commit is contained in:
Dandaedre 2026-09-16 17:38:55 +02:00
parent 64c30968a2
commit 006d45c890
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
3 changed files with 7 additions and 3 deletions

View File

@ -84,7 +84,7 @@ are rejected, including legacy `diagnostics`, top-level `organization` and named
Unknown or misspelled blocks fail validation. Text and commands are data, not code
for the validator to execute. The renderer must preserve that boundary.
Within a `text` block, balanced single backticks mark inline code, for example
`` `5661ea1` ``. The renderer uses Typst's inline raw text for the marked span;
`` `5661ea1` ``. The renderer shows Typst's inline raw text as a small rounded pill;
unmatched backticks remain literal. This formatting never executes report text.
Cards render as rounded, shaded panels. Omit `tone` for a neutral panel or set
it to a severity token to tint its border and background. A card may contain

View File

@ -91,6 +91,10 @@
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)
#show raw.where(block: false): box.with(
fill: soft, stroke: 0.5pt + line-color, radius: 3pt,
inset: (x: 4pt, y: 1pt), outset: (y: 1pt),
)
#text(size: 22pt, weight: "bold", fill: accent)[#as-text(report.title)]
#if "subtitle" in report { v(3pt); text(size: 11pt, fill: muted)[#as-text(report.subtitle)] }

View File

@ -107,8 +107,8 @@ class RenderTests(unittest.TestCase):
renderer.render(input_path, output, TYPST)
self.assert_pdf(output)
if PDFTOTEXT:
extracted = subprocess.check_output([PDFTOTEXT, str(output), "-"], text=True)
self.assertIn("Pinned 5661ea1 and 5969196.", extracted)
extracted = subprocess.check_output([PDFTOTEXT, "-layout", str(output), "-"], text=True)
self.assertRegex(extracted, r"Pinned\s+5661ea1\s+and\s+5969196\s*\.")
self.assertIn("Unmatched ` stays literal.", extracted)
def test_existing_output_requires_force_and_input_is_never_output(self):