Code
Highlighted at build time by Shiki, in the palette's colors. The copy button needs JS and is absent without it.
typescriptProps of typescript
<Code code="/** Writes the pointer position on each subscriber, once a frame. */\nexport con…" lang="ts" title="src/lib/pointer.ts" />/** Writes the pointer position on each subscriber, once a frame. */
export const track = (targets: HTMLElement[]) => {
let raf = 0;
addEventListener("pointermove", (event) => {
if (event.pointerType !== "mouse") return; // touch has no hover
raf ||= requestAnimationFrame(() => {
raf = 0;
for (const el of targets) el.style.setProperty("--x", `${event.clientX}`);
});
});
};astro-numberedProps of astro-numbered
<Code code="---\nimport Button from \"../components/ui/button.astro\";\n\nconst { label = \"Save\"…" lang="astro" title="save.astro" lineNumbers />---
import Button from "../components/ui/button.astro";
const { label = "Save" } = Astro.props;
---
<form method="post">
<Button type="submit">{label}</Button>
</form>cssProps of css
<Code code=".card {\n padding: var(--space-md);\n border: 1px solid var(--color-border)…" lang="css" />.card {
padding: var(--space-md);
border: 1px solid var(--color-border);
&:hover {
border-color: var(--color-primary);
}
}shellProps of shell
<Code code="$ deno run build\n✓ Completed in 1.2s\n$ deno run check" lang="shellsession" />$ deno run build
✓ Completed in 1.2s
$ deno run checkwrapProps of wrap
<Code code="const message = \"A line long enough that it runs past the edge of the block, wh…" lang="js" wrap />const message = "A line long enough that it runs past the edge of the block, which shows whether it wraps or scrolls";scrollProps of scroll
<Code code="const message = \"A line long enough that it runs past the edge of the block, wh…" lang="js" />const message = "A line long enough that it runs past the edge of the block, which shows whether it wraps or scrolls";plainProps of plain
<Code code="No language: plain text." />No language: plain text.inlineProps of inline
<Code code="font: var(--type-code)" lang="css" inline />font: var(--type-code)