Diagnostics

Typst has no public API to emit a soft compiler warning from user code, so the closest available approximation is a visible marker rendered directly at the fault location, which most Typst editors preview live.

diagnose(message, always: false)
reports a problem at the call site. Under set-strict(true), always a hard panic — a real compile error, in any mode. Otherwise, a visible inline marker — muted specifically when variant() == "plain" and preview() is off (always: false, the default), since that’s the file most likely to leave this codebase and reach someone who never asked to see an internal warning; shown unconditionally when always: true, for a diagnostic embedded in a document that is never itself the deliverable (a generated report, an internal checklist) where muting it would mean it’s never seen at all.
set-strict(v)
turns every diagnose(...) call, anywhere in the bundle, into a hard error at once — one shared CI gate rather than a check per document. Normally set via bundle(strict: true, ...), not called directly.

xref (below) always passes always: true — a broken cross-reference should never be silently invisible even in the real, submitted deliverable:

#import "../../lib.typ": *

#set page(width: 16.6cm, height: auto, margin: 12pt)
#set text(size: 10.5pt)
#set heading(numbering: "1.")

= Results <sec-results>

#figure(table(columns: 2, [*Arm*], [*n*], [A], [120], [B], [118]), caption: [Participants per arm.]) <tab-n>

See #xref(<tab-n>) and #xref(<sec-results>) above. This one doesn't exist: #xref(<tab-missing>).
← Two independent compile axesxref →