Widget Test Fixture Skip to main content

Widget Test Fixture

Exhaustive coverage of every toolkit directive. Not for readers — for regression testing.

Widget Test Fixture

This document exercises every directive, control kind, and code-fence annotation documented in docs/blog/toolkit.md and docs/blog/cheatsheet.md. Each ## section exhibits one category so a failing widget is easy to locate visually. Prose is deliberate filler — lorem ipsum between examples — so pagination and typography render against realistic-looking content.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Standard Markdown

Paragraphs, lists, tables, blockquotes, and other GFM features must render with @tailwindcss/typography polish. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Headings h3

Headings h4

Headings h5
Headings h6

Unordered list:

  • Alpha
  • Beta
  • Gamma

Ordered list:

  1. First
  2. Second
  3. Third

Task list:

  • Done item
  • Pending item

Inline emphasis: italic, bold, strikethrough, inline code, a link, and an image: alt text

Blockquote:

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Table:

Column A Column B Column C
alpha 1 left
beta 22 centre
gamma 333 right

Horizontal rule follows:


Footnotes (GFM). The first paragraph below references two1. The second paragraph re-uses the same identifier1, which remark-gfm collapses into one footnote body with multiple back-arrows.

A long tangent2 can live below the article flow without interrupting the sentence. Numeric IDs work too3 — they behave the same as named ones; the rendered superscript is always 1, 2, 3 in document order regardless of how authors label them.

Escape sequences. A backslash before a markdown-active character tells the parser "this is a literal glyph, not syntax". Useful when prose needs to discuss markdown itself or contains characters that would otherwise be interpreted (e.g. leading # in a value, underscores in identifiers like snake_case_name, or asterisks in notation).

  • Asterisks without italic: *literal asterisks*
  • Underscores without emphasis: _not italic_
  • Brackets without a link: [not a link](no url)
  • Tildes without strikethrough: ~~not struck through~~
  • Leading hash without a heading: # not an h1
  • Literal backtick: ` followed by not-inline-code
  • Literal backslash: \ (one slash emitted)

Without the backslash, italic / italic / link / strike / # heading would trigger their normal parsing — so escape is the explicit opt-out.


Text directives (inline)

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.

This paragraph opens with a dropcap directive. Dropcaps elevate the first letter of the enclosing paragraph with a prominent typographic treatment. Nemo enim ipsam voluptatem quia voluptas sit aspernatur.

Press CtrlK to open the command palette, or Shift? for the keyboard-shortcuts overlay. Neque porro quisquam est qui dolorem ipsum quia dolor sit amet.

The DOM is a tree-shaped in-memory representation of the page, and SVG is rendered inline as part of that same tree. Ut enim ad minima veniam.

This sentence contains highlighted text in the middle, because the :mark directive exists for exactly that purpose. Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse.

Block typography

Pullquote

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti.

The best developer-experience improvements feel invisible — you only notice them the moment they disappear.

— Josh W. Comeau

Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit.

Glossary

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet.

viewBox
The internal coordinate system of an SVG, independent of the rendered pixel size.
Bezier curve
A smooth path defined by control points; the mathematical basis for SVG <path> curves.
Stroke-dasharray
A CSS property describing the alternating dash-and-gap pattern along an outline.

Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus.

Block callouts — one per tone

The toolkit defines six callout directives by name (per toolkit.md §3.1), not one :::callout directive with a type= attribute. Each tone has its own directive.

Omnis dolor repellendus autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur.

:::note — neutral blue

Plain informational note with no extra props. Content supports full Markdown, including lists, inline code, and nested emphasis.

:::note with title

Notes can carry an optional title= attribute that renders as a heading inside the callout.

:::tip — actionable green

You will reach for this cheat sheet every time you write a viewBox.

  • Tip one
  • Tip two

:::warning — amber caution

Setting width or height to zero makes SVG refuse to render — no error, no warning. First thing to check when your rect vanishes.

:::danger — red critical

Running rm -rf with the wrong argument has no confirmation step and no undo. Read the path twice before you press Enter.

:::caveat — purple exception

Normally SVG strokes centre on the edge; however, some rendering engines quantise sub-pixel strokes differently, producing small shifts at fractional widths.

:::aside — muted tangent

Tangential but relevant context that a hurried reader can safely skip.

Callout with icon override

The icon= attribute overrides the default. Accepts a lucide name, an SVG path, or an emoji per toolkit.md §3.1.

Compact callout

compact reduces vertical padding for tight-flowing content.

Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus.

Results and outcomes

Outcomes, summaries, and try-it blocks delimit the reader's path through an article. They are semantically distinct from callouts.

Voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae.

4.8×
faster render
4.8×
faster render
4.8×
faster render
4.8×
faster render
First article ships

Layout directives — tabs

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae.

npm install @oboxsystems/blog-toolkit
pnpm add @oboxsystems/blog-toolkit
yarn add @oboxsystems/blog-toolkit

Layout directives — grid (columns)

Spec does not define a :::columns directive; the equivalent is :::grid{cols=N gap="..."} per toolkit.md §3.2.

Column one — lorem ipsum dolor sit amet, consectetur adipiscing elit.

Column two — sed do eiusmod tempor incididunt ut labore et dolore magna.

A

B

C

1

2

3

4

Layout directives — other

Before

Old approach, with its limitations.

After

New approach, and why it is better.

Why is it called that?

Details render as <details><summary>…</summary>…</details>. Accepts an optional open attribute to start expanded.

Open by default

This one starts expanded because of the open attribute.

Basics

A wrapped section

:::section groups a chunk of prose with an optional eyebrow label, id, and accent colour.

  1. Install

    npm install the package.

  2. Configure

    Edit the config file.

  3. Ship

    Run npm run build.

This block breaks out past the main column width for a visual pause. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore.

Full-bleed region, edge-to-edge. Use sparingly per toolkit.md §3.2. Full-bleed region, edge-to-edge. Use sparingly per toolkit.md §3.2. Full-bleed region, edge-to-edge. Use sparingly per toolkit.md §3.2. Full-bleed region, edge-to-edge. Use sparingly per toolkit.md §3.2.

Media directives

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Local video (defaults — no autoplay, no loop, audible)

Default video — autoplay/loop/muted all OFF; reader presses play

Local video — explicit looping-illustration opt-in

Looping illustration — autoplay loop muted flags set explicitly

Local video — simple mode

Simple mode — only a centred play / pause toggle, no controls bar

YouTube (lite-embed)

YouTube URL — rendered via lite-youtube-embed
Same video via canonical youtube.com URL

Figure

Diagram of a viewBox

A captioned image — caption supports inline Markdown.

SVG embed

Demo viewBox diagram viewBox="0 0 320 200"

Compare slider

Custom embed

Click the dot to change colour

Code fences — metadata variants

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores.

Language variants — plain

<!doctype html>
<html>
  <body>Hello</body>
</html>
.box { background: tomato; }
<svg viewBox="0 0 10 10"><circle cx="5" cy="5" r="4" /></svg>
export const Box = () => <div className="box">Hi</div>;

Title annotation

example.tsx
export function example() {
  return "hello";
}

Line highlight — range

example.tsx
import { useState } from "react";

function Counter() {
  const [count, setCount] = useState(0);
  return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
}

showLineNumbers + inline-pattern highlight

App.jsx
import { useState } from "react";

export default function App() {
  const [n, setN] = useState(0);
  return <button onClick={() => setN(n + 1)}>{n}</button>;
}

Diff fence

  const greet = (name) => `Hello, ${name}`;
  const greet = (name = "world") => `Hello, ${name}`;

Collapsed fence

Show long-file.js
// Pretend this file is 400 lines long.
function a() {}
function b() {}
function c() {}

Playground — static mode (inline)

Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat.

Static with CSS-variable controls (no JS)

<div class="box"></div>
Static playground driven by CSS custom properties

Static with sibling-folder src

<div class="static-snippet">
  <span class="dot"></span>
  <p>Static snippet works</p>
</div>

Static snippet works

Static playground sourced from ./snippets/static-example/

Static with bindings — from (direct)

index.html
<svg width="240" height="160">
  <line x1="20" y1="140" x2="220" y2="20"
        stroke="#f39c12" stroke-width="3" />
</svg>
Direct binding — control value goes straight to one attribute

Static with bindings — template (interpolation)

index.html
<svg viewBox="0 0 300 200" width="100%" height="200">
  <rect x="50" y="30" width="200" height="140"
        fill="#9b59b6" fill-opacity="0.2"
        stroke="#9b59b6" stroke-width="3" rx="8" />
</svg>
Template binding — compose multiple controls into one attribute string

Static with bindings — compute (helper expression)

index.html
<svg width="300" height="200">
  <polygon points="150,40 201,70 201,130 150,160 99,130 99,70"
           fill="#1abc9c" fill-opacity="0.2"
           stroke="#1abc9c" stroke-width="2"
           stroke-linejoin="round" />
</svg>
Compute binding — JS expression using toolkit helpers

Playground — vanilla mode (inline)

Accusantium doloremque laudantium, totam rem aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

Vanilla with inline HTML + CSS + JS

<div id="stage"></div>
Vanilla JS playground — mount(container, controls) contract

Vanilla with sibling-folder src

<div class="test-snippet">
  <span class="dot"></span>
  <p>Test snippet works</p>
</div>
Vanilla playground sourced from ./snippets/example/

Playground — react mode (inline)

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint.

Playground — live mode

A lightweight HTML / CSS / JS editor backed by an iframe srcdoc — no bundler, no JSX, no module resolution. The reader can tweak the source and watch the iframe re-run on every keystroke (debounced ~200ms). Ideal for "edit-this-snippet-and-see-what-happens" demos that don't need React or imports.

Live HTML/CSS/JS editor — tweak any tab to update the iframe

Playground — sandpack mode

Sandpack full layout

Sandpack sibling-folder form

Playground — layouts

Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit.

layout="preview-only"

index.html
<svg width="120" height="120">
  <circle cx="60" cy="60" r="50" fill="#3498db" />
</svg>
Preview only — no controls, no editor

layout="controls+preview"

<svg width="120" height="120"><circle class="c" cx="60" cy="60" fill="#e74c3c" /></svg>
Controls + preview — no code editor

layout="editor+preview"

layout="full"

Controls — one example of every v1 kind

Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.

Accessibility-focused controls

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint.

Closing

Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur.

Footnotes

  1. A short footnote. Collected at the bottom of the article, with a ↩ link back to the reference point. ↩ ↩2

  2. Footnotes can carry multiple sentences, inline code, links, and even emphasis. They're the right tool when the side-remark would derail the main sentence but still deserves to be said somewhere readable. ↩

  3. Identifier is private to the article. The reader sees auto-numbered superscripts. ↩