Style guide: how this blog looks
Every element a post here can use, written the way Lene and I write them.
Lene asked for one page that shows how everything looks before she writes a guest chapter. This is it. Each heading names the element below it.
Heading level two
Sections a reader jumps to, such as "The unit file". They fill the table of contents.
Heading level three
A step inside a section. Indented in the table of contents.
Heading level four
Rare. Used once, for the variants of a config option.
Heading level five
Not used yet.
Heading level six
Not used yet either, but it has a size.
Paragraph with inline formats
The router is 20 lines, none of them a regular expression, and the nodemon watcher is gone. Write commands as node --watch. The handler is pure, p99 stays under 5 ms, 210 requests is where it starts to show, and the test suite runs in 41 ms. More in chapter 3.
Bulleted list
- Node 24, nothing else.
- One chapter a fortnight.
- Code for every chapter in the repository.
Numbered list
- Write the test.
- Make it pass.
- Delete what you no longer need.
Blockquote
A handler takes a Request and returns a Response. Everything else is somebody’s framework.
Aside quote
Lene’s rule for reviews: if I have to run it to understand it, the post is missing a sentence.
Code block with a file name
export function route(method: string, pattern: string, handler: Handler) {
routes.push({ method, parts: pattern.split('/'), handler });
}Terminal
$ node --version
v24.11.1
$ curl -s localhost:8080/posts/hello
You asked for: helloDiff
-const handle = () => new Response('Hello');
+const handle = match;Marked, added and removed lines
const port = Number(process.env.PORT ?? 8080); // [!code highlight]
const host = '0.0.0.0'; // [!code --]
const host = '127.0.0.1'; // [!code ++]Tabs
$ pnpm add -D @types/node$ npm install --save-dev @types/node$ yarn add --dev @types/nodeLong block, folded
name: test
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- run: npm ci
- run: npm test
- run: npm run lint
- run: node --test --experimental-test-coverage test/Wrapped lines
[server]
base_url = "https://stummel.example"
allowed_targets = ["example.org", "example.com", "docs.example.org", "blog.example.com", "status.example.org"]Code with a caption
SET lock_timeout = '5s';Horizontal rule
Separates a postscript from the post.
Image, regular width

Image with a link

Image, wide

Image, full width

Gallery with two images


Gallery with three images



Callouts
Note, tip, warning and danger take the colours of the code. The others follow Ghost’s callout colours.
.ts files directly. Older versions need --experimental-strip-types.duplex: 'half' is required for a request with a streamed body.Toggle
Why no framework?
Because the series is about what a framework does for you. Use one afterwards.
Does it run on Bun or Deno?
The router does. The server uses node:http; chapter 1 shows the four lines to change.
Bookmark

A second bookmark

Button
Button, centred
Header card
Header card, split with image

Header card, centred
41,380 requests a second
Without the router. 38,905 with it.
Signup card
Call to action
stummel runs on a mini PC that costs 4 euros a month in power. Supporters pay for it.
Call to action for members
Only members see the card under this heading. Sign in and it shows up here.
Product
The mini PC under the desk
Four cores, 16 GB, 6 watts at idle. Every benchmark on this blog ran on it.
Audio
Video
Looping video
File
Embed
stummel.example: all checks green for 26 days.
HTML card with a table
| Chapter | Lines added |
|---|---|
| 1 | 11 |
| 3 | 20 |
| 4 | 18 |
Markdown card with a table
| Command | What it does |
|---|---|
node --watch |
restarts on save |
node --test |
runs the tests |
Typesetting
The first paragraph of a post is set larger. These posts show the other variants:
- What two years of on-call did to my alerts opens with a drop cap.
- Why I write the test first, sometimes opens with small capitals.
- Benchmarks on a mini PC are honest enough is set justified.
- Pairing on a parser has no larger first paragraph.
Members pages
Readers who sign up meet four pages: Sign up, Sign in, Account and Pricing.
subscribe
New entries and the next chapter by mail, nothing else.
