Hello, and a stack smoke test
The first post on this blog, which exists mainly to prove that code blocks, math and diagrams all render the way they should.
This is a placeholder post. It exists so the build has something to chew on, and so every part of the rendering pipeline gets exercised at least once. Delete it once there’s a real post to replace it.
Code blocks
Go, with a filename title and a highlighted line:
func worker(jobs <-chan Job, results chan<- Result) { for job := range jobs { results <- process(job) }}
// The unbuffered send above is where the goroutine parks.TypeScript, with diff markers:
export function memoize<A, R>(fn: (arg: A) => R) { const cache = new Map<A, R>(); return (arg: A) => cache.get(arg) ?? fn(arg); return (arg: A) => (cache.has(arg) ? cache.get(arg)! : set(cache, arg, fn(arg)));}Shell output, which should not be highlighted as code:
$ go test -bench=. -benchmemBenchmarkProcess-10 1284517 931.2 ns/op 248 B/op 3 allocs/opMath
Inline first: a balanced binary search tree gives lookups, and the
usual argument for why a heap’s push is cheap amortized runs through the
recurrence below.
Diagrams
Mermaid source in the post, rendered to inline SVG at build time, so readers download no JavaScript for it:
What isn’t here
Interactive islands. Those arrive per-post: rename the file to .mdx, import a
Preact component, and give it a client:visible directive.