Code sample
A code figure with a label, a copy button and annotations. A quiet header row shows the language or the file name, and the copy button confirms on its own label. The code sits in a recessed area that scrolls sideways and does not wrap. The author can highlight a line or a word, dim all but the part under discussion, and mark the added and removed lines of a diff. These comment notations never go to the clipboard. Long files get a line limit that scrolls and does not clip, with an expand button when the limit applies. Shiki highlights the code with the text colours of the system, so each colour is a value that the generator already checked against the surface below it.
submit.tsxexport function Submit() { return <Button emphasis="loud">Continue</Button>;}import { CodeSample } from "../../blocks/code-sample";const SOURCE = `export function Submit() { return <Button emphasis="loud">Continue</Button>;}`;export default async function Example() { return CodeSample({ code: SOURCE, lang: "tsx", title: "submit.tsx", lineNumbers: true });}