Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Preformatted text preserving whitespace and line breaks. VB distinguishes code blocks (pre+code) from bare preformatted text (poetry, ASCII art) with different visual treatments.
The <pre> element preserves whitespace and line breaks exactly as written in the HTML source. VB makes an important distinction:
<pre><code> (code blocks) — Full treatment with background, padding, border-radius, and white-space: pre with horizontal scroll<pre> (no <code> child) — Lighter treatment with pre-wrap and no background, for ASCII art, poetry, or other preformatted text that isn't codeThis distinction uses pre:has(code) — no classes needed.
<code> inside <pre> for multi-line source code<samp> inside <pre> for command output<pre> for art that depends on character alignment<pre> when line breaks are part of the content's meaning<table> is usually better)The canonical pattern for displaying source code. VB detects the <code> child via pre:has(code) and applies full code-block styling:
<pre><code>function greet(name) { return `Hello, ${name}!`;} console.log(greet('World'));</code></pre>
<b> and <strong> inside code blocks get a subtle background highlight instead of relying on font weight alone:
/* Bold in code — highlight background */:where(code, pre) :where(b, strong) { background-color: oklch(from var(--color-interactive) l c h / 0.12); border-radius: var(--radius-s); padding-inline: var(--size-2xs);}
For colored syntax highlighting, VB provides the <code-block> web component (used throughout this documentation site). For external tools, add class="language-*" to the <code> element and integrate Prism.js or highlight.js.
Use <samp> inside <pre> for command-line output. This gets code-block styling since samp behaves like code in this context:
<pre><samp>$ npm installadded 125 packages in 3.2s $ npm run buildBuild completed successfully.</samp></pre>
Without a <code> or <samp> child, <pre> gets lighter styling — no background, no padding, and white-space: pre-wrap so long lines wrap rather than scroll. This is appropriate for ASCII art, poetry, and other preformatted text that isn't code.
<pre> * *** ***** **************** |||</pre>
<pre>Two roads diverged in a wood, and I—I took the one less traveled by,And that has made all the difference.</pre>
pre { font-family: var(--font-mono); font-size: var(--font-size-sm); overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;} /* Code blocks: pre containing code gets full treatment */pre:has(code) { background: var(--color-surface-raised); padding: var(--size-m); border-radius: var(--radius-m); white-space: pre; word-wrap: normal; & code { background: transparent; padding: 0; font-size: inherit; }}
| Context | Background | White-space | Scroll |
|---|---|---|---|
pre:has(code) |
var(--color-surface-raised) |
pre (exact) |
Horizontal |
Bare pre |
None | pre-wrap (wraps) |
None |
/* Print: pre blocks avoid page breaks */@media print { pre { break-inside: avoid; }}
<pre> content in its linear ordertabindex="0" to scrollable code blocks so keyboard users can scroll with arrow keysrole="region" and aria-label for complex code blocks that benefit from a landmarkaria-label or alt text describing what it depicts