# Kitchen sink: every building block this blog can render

- Published: 2026-11-20
- Tags: meta, design
- URL: https://www.neilujd.tech/blog/kitchen-sink

> A working style guide for this site. Every MDX component, code block, diagram and media type on one page, with notes on when to use each.

Every design system needs one page where everything lives side by side. This is that page for this blog. When I change a colour token, a font or a spacing step, I open this post first: if something looks wrong here, it will look wrong somewhere real.

It also doubles as documentation. Each section shows a building block, then says when I reach for it.

## Plain Markdown first

Most of a post is still plain Markdown, and it should stay that way. Paragraphs carry **strong emphasis**, _regular emphasis_, `inline code`, and [links to other pages](/blog). A footnote adds context without breaking the flow of a sentence.[^footnotes]

### Lists

Unordered lists hold things that have no order:

- Semantic HTML before ARIA
- Visible focus on every interactive element
- Motion that respects `prefers-reduced-motion`
  - Nested items work too
  - But two levels is the limit

Ordered lists hold sequences:

1. Write the post in MDX.
2. Run the build.
3. Read the result on a phone before publishing.

### Tables

| Element     | Purpose                | Needs JavaScript |
| ----------- | ---------------------- | ---------------- |
| `<details>` | Disclosure, accordion  | No               |
| `<dialog>`  | Modal and non-modal UI | To open it       |
| `<output>`  | Result of a calculation | No              |

### Blockquotes

> A plain Markdown blockquote is fine for a short aside. When the quote has an author or a source, use the `Quote` component below instead.

## Callouts

Callouts pull one point out of the text. I use them sparingly: one or two per post at most.

<Callout type="note">
  The default type. Context the reader may want, but can skip.
</Callout>

<Callout type="tip" title="Use the title prop">
  A custom title replaces the type label. Keep it short.
</Callout>

<Callout type="warning">
  Something that will bite if ignored, such as a breaking change in a dependency.
</Callout>

<Callout type="danger" title="Data loss">
  Reserved for actions that cannot be undone. If every callout is red, none of them is.
</Callout>

## Code

Code blocks go through Expressive Code. A title names the file, and line markers draw the eye to what changed.

```ts title="src/lib/reading-time.ts" {4-5}

  const { minutes } = getReadingTime(body);
  return Math.max(1, Math.round(minutes));
}
```

A diff block shows a change in place:

```diff lang="ts"
   site: 'https://www.neilujd.tech',
-  trailingSlash: 'always',
+  trailingSlash: 'never',
+  build: { format: 'file' },
 });
```

Keyboard shortcuts get their own element: press <Kbd>Ctrl</Kbd> + <Kbd>K</Kbd> to search, or <Kbd>Esc</Kbd> to close. Status labels use badges: <Badge>draft</Badge> <Badge variant="accent">new</Badge>.

## Diagrams

Mermaid diagrams render to SVG at build time, so the reader downloads markup, not a charting library. Wide diagrams scroll sideways on small screens instead of shrinking to unreadable sizes.

<Diagram caption="How a post goes from MDX to HTML: remark parses Markdown, rehype turns Mermaid into SVG, then components render.">

```mermaid
flowchart LR
  A[index.mdx] --> B[remark] --> C[rehype] --> D[components] --> E[HTML]
```

</Diagram>

## Images and video

Images live next to the post and go through `astro:assets`, which outputs AVIF and WebP in several widths. The `wide` prop lets a figure break out of the text column.

<Figure src={pipeline} alt="Three boxes joined by arrows: index.mdx, Astro build, post.html." caption="The build pipeline, as an image this time." wide />

Short clips use the native video element with captions. This one is 4 seconds and weighs under 50 kB.

<Video src="/media/focus-ring.webm" poster="/media/focus-ring-poster.png" captions="/media/focus-ring.en.vtt" title="A focus ring fading in around a button" />

YouTube videos never load YouTube on this site. The thumbnail is downloaded at build time and served from here, and the card links out to the video.

<YouTube id="dsTXcSeAZq8" title="Astro in 100 Seconds" />

## Quotes

<Quote cite="Tim Berners-Lee" source="Introduction to Web Accessibility, W3C" href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">
  The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.
</Quote>

A pull quote repeats a line from the post in large type, to give a long article a visual rest:

<PullQuote>If every callout is red, none of them is.</PullQuote>

<Section id="anchored-sections" title="Anchored sections">
  The `Section` component renders a heading that links to itself, so any section can be shared with a precise URL. Regular Markdown headings get ids too; this component is for when the section needs a stable id that does not change with its title.
</Section>

## Step by step

<Steps>

1. Create a folder in `src/content/blog/` named after the post slug.
2. Add an `index.mdx` file with a title, a description and a publication date.
3. Put images in the same folder and import them where they appear.
4. Run `pnpm build` and open the post at 390 pixels wide.

</Steps>

## Tabs

Tabs hold alternatives where the reader needs only one, like install commands for different package managers. They work without JavaScript and fall back to a list of disclosures when the browser cannot lay them out as tabs.

<Tabs>
  <Tab label="pnpm">

```sh
pnpm add astro-expressive-code
```

  </Tab>
  <Tab label="npm">

```sh
npm install astro-expressive-code
```

  </Tab>
  <Tab label="yarn">

```sh
yarn add astro-expressive-code
```

  </Tab>
</Tabs>

## Comparing options

<Compare
  caption="Three ways to embed a YouTube video"
  rowHeader="Criterion"
  columns={['iframe embed', 'Lite embed script', 'Thumbnail link']}
  rows={[
    { label: 'Works without JavaScript', values: [true, false, true] },
    { label: 'No third-party request on load', values: [false, true, true] },
    { label: 'Plays inline', values: [true, true, false] },
    { label: 'Weight on page load', values: ['~1 MB', '~5 kB', 'One image'] },
  ]}
/>

## Further reading

<LinkCard href="https://docs.astro.build/en/guides/integrations-guide/mdx/" title="@astrojs/mdx" description="How Astro compiles MDX, and how to pass custom components to the rendered content." />

<LinkCard href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html" title="Understanding Contrast (Minimum)" description="Why body text needs a 4.5:1 contrast ratio, and how WCAG defines it." site="W3C" />

## One small island

Everything above ships zero JavaScript. This last block is the exception: a contrast checker built as a Web Component. Without JavaScript, it still shows the result for its default colours. With JavaScript, it recalculates as you pick new ones.

<ContrastCheck foreground="#a3a9b2" background="#15181d" />

## Questions

<FAQ
  items={[
    { question: 'Why MDX and not plain Markdown?', answer: 'Plain Markdown covers most of a post. MDX adds components like callouts and tabs without a client-side framework, and they render to static HTML at build time.' },
    { question: 'Does this page load any third-party script?', answer: 'No. The YouTube thumbnail is downloaded at build time and served from this domain, and the share links below the post are plain links.' },
    { question: 'Why are there no comments?', answer: 'Comments need moderation and a third-party service. Email and social replies work fine for a personal blog.' },
  ]}
/>

[^footnotes]: Footnotes come from GitHub Flavored Markdown. They collect at the end of the post, with a link back to where they were referenced.
