~/writing · post
wikilinks at build time
This site’s notes section supports [[wikilinks]] — Obsidian-style double-bracket
links between notes. The interesting constraint I set myself: backlinks must cost
zero JavaScript. The graph is computed once, at build time, and shipped as plain HTML.
how it works
- A remark plugin turns
[[slug]]into a styled link during markdown compilation. - A separate build-time module globs the raw note files, regexes out every link, and builds two maps: outgoing and incoming.
- The note template asks
backlinksFor(slug)and renders a “linked from” panel.
No hydration, no client graph library, no JSON payload. The garden is gossip between markdown files, resolved before the site even exists.
If you want the details, the machinery lives in two small files:
src/lib/remark-wikilinks.mjs and src/lib/garden.ts.