Rough Magic

On Wikilinks and Backlinks

How forward links and backlinks work, with a code peek.

The syntax is small. Link by id, alias the text, deep-link to a heading, or force a collection:

[[colophon]] → links to the note titled "Colophon"
[[colophon|how it's built]] → custom link text
[[colophon#tools]] → deep link to a heading
[[blog:hello-world]] → force the blog collection

Forward links are rewritten by a small remark plugin that only touches text nodes, so it’s safe inside MDX:

export function remarkWikilinks() {
return (tree, file) => transform(tree, file);
}

Backlinks are the inverse, crawled at build time. Linking here to the Colophon means the colophon will list this post under “Linked from”. See Welcome to the Garden for the broader idea.