326. Std doc examples run in the page; costs render as math (site, 2026-11-22)
- 326.1 Each
example:line becomes a program.gen-refsplits it at top-level;, puts the module'suse std.<module>.*and the setup most of a type's examples share in a collapsed Setup, and ends withprint(expr), orassert(expr == value)when the value can't be printed; the stated value is shown as the Result. Each program is run at build time (16 at a time, cached by hash) and only one that runs is shown runnable; the rest stay static and are listed inweb/node_modules/.cache/doc-examples-failing.txtfor stdlib (286 of 2,767 today). Why: Ryan found one-line wrapped examples unreadable, and a runnable example has to be one that runs. Reverse: renderexample:lines as list items again inrenderItem.
- 326.2 Math is LaTeX in
\( ... \), rendered with KaTeX at build time (remark-math with single dollars off, rehype-katex; KaTeX CSS only on docs and lint pages, so/is unchanged). Until stdlib converts its doc comments,cost:lines in the oldO(n log n)form are converted (log,·,α,²,sqrt). The build fails on a math span KaTeX can't render. Reverse: drop the two plugins andtexSpans.
- 326.3 Signatures over 72 columns are laid out one parameter per line, defaults kept, as
cpl fmtlays out a long call. Reverse:layoutSignaturereturns its input.