mirror of
https://github.com/runbear-io/beardrive.git
synced 2026-08-25 08:08:08 +02:00
[[guide]] rendered as href="wiki:guide" — a pseudo-scheme no browser can resolve. The delegated click handler rescued a plain left-click, so the feature looked fine until someone copied the link, middle-clicked it, or opened it in a new tab and got a dead string. Resolution moves from click time to transform time: transformHTML (the pass that already rewrites this HTML before the mount) matches the target against flatFiles and writes the real urlForPath() URL, plus a data-wiki marker. A wikilink matching no file loses its href entirely and renders as .wiki-missing, so no "wiki:" survives into the DOM either way. The matching rules didn't change — they moved into a pure resolveWiki() in util.ts, where node --test covers the whole matrix without a browser. The consequence to get right is the click: real hrefs mean a plain click must be intercepted (or it does a full document load) and every modified click must be let through (or the fix buys nothing) — the same rule nav.ts:linkProps applies everywhere else. The guard sits above both branches, so cmd-clicking a relative markdown link now opens a tab too instead of SPA-navigating the current one. markdown.go is unchanged: wiki: stays the marker the server leaves behind because RenderMarkdown has no file tree. /s/<token> share pages keep their dead wikilinks by the spec's decision — the target isn't part of the share. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>