Crafting a minimalist typography engine
A comprehensive look into typeset CSS, design tokens, code syntax highlighting, and custom components.
When building a personal site, text is the primary interface. Getting typography, line-height, and contrast right creates an editorial experience that feels effortless.
Designing the Core Architecture
Building a clean typographic system requires balancing layout constraints with fluid readability.
Key Design Principles
Here are the core principles that guided the refactor:
- Streaming-safe block spacing: Margin block start handles flow without breaking streaming text.
- Semantic CSS variables: OKLCH color tokens power both light and dark modes seamlessly.
- Zero bloat: Standard CSS custom properties instead of complex utility class soup.
Implementation Checklist
- Audit hardcoded color tokens across all pages.
- Register
--color-subtleand semantic theme variables inglobals.css. - Replace inline style overrides with reusable
typesetpresets.
Markdown Elements & Syntax
Good typography handles rich formatting cleanly — from bold emphasis and italic nuances to inline code blocks like npm run dev.
Code Snippets
Here is a custom CodeBlock component with a filename header, syntax highlighting, and instant copy button:
export function formatDate(dateStr: string): string {
return new Date(dateStr).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
})
}Visual Assets & Media
Below is a custom ImageBlock component featuring an optional editorial caption:

"The details are not the details. They make the design." — Charles Eames
Ordered Steps for Content Flow
- Parse MDX frontmatter using
gray-matter. - Format raw timestamps with
tabular-numsfor precise alignment. - Render article bodies inside the
.typeset-articlewrapper.