How a note becomes a page
Every post on this site starts as a plain Markdown file. A handful of Markdoc tags add what Markdown cannot say on its own, and the renderer turns each of them into a component from the design system. Nothing in the file knows how it will look.
The plain parts
Paragraphs keep a measured line, with strong words, emphasis, inline code and links that carry a steady underline.
Simplicity is prerequisite for reliability.
— Edsger W. Dijkstra
Lists nest when they need to:
- Plain Markdown for everything ordinary
- Markdoc tags for the rest:
- callouts and figures
- code with a title
- maths and diagrams
- Nothing else
And they can count, or keep track:
- Write the note.
- Publish it.
- Read it here.
- Callouts, code and maths
- Diagrams drawn from text
- Drawings readers can play with
| Tag | Becomes | Notes |
|---|---|---|
callout | a tinted card | four states |
codefence | highlighted code | with a title |
math, mathblock | typeset maths | inline or display |
mermaid | a diagram | drawn in the browser |
figure | an image or a film | with a caption |
A diagram
flowchart LR
Note[Markdown note] --> Check{Known tags?}
Check -->|yes| Render[Components]
Check -->|no| Plain[Plain text, kept safe]
Render --> Page[This page]Code
function wallImageSpan(image: WorkImage, matUnits: number): number {
const pictureUnits = WALL_UNITS_PER_COLUMN - matUnits * 2;
return Math.round((pictureUnits * image.height) / image.width + matUnits * 2);
}
Plain fences work too:
.site-cursor__mark[data-mode="action"] {
background: color-mix(in oklch, var(--site-cursor-color) 30%, transparent);
}
Maths
The work wall measures in rows of a column's width, with rows to a column. A picture of width and height in a mat of rows takes
A figure
