wherefore: standardize cross-links as relative Markdown links - #12
Merged
Conversation
Inline cross-references between wherefore items now use a standard relative Markdown link to the target file (e.g. [P-004: label](P-004-slug.md)), never a bare slug or an Obsidian [[wikilink]]. Markdown links render as real links everywhere -- GitHub, Obsidian, editors, and the dashboard -- which wikilinks do not. Frontmatter refs stay bare; this is for body prose only. Docs + skills: - AGENTS.md gains a canonical "Linking" section (propagates to the scaffolded template); capture/slate/supersede/resolve skills, seed's embedded plan README, wherefore/plan/README.md, and a CLAUDE.md pointer teach the same format. Dashboard: - New src/lib/md-links.mjs: config-time filename->route map + pure rewriteMdHref. - New rehype plugin rewrites .md hrefs to routes for pipeline-rendered bodies (plan/questions/now-view); log bodies get the same rewrite threaded through renderInline (which also now protects link syntax shown inside code spans). - Requires @astrojs/markdown-remark so Astro 7's rehype path is available. Dogfood: - Migrated this repo's 4 "See also" lines to Markdown links; captured the decision in 2026-07-19-markdown-crosslinks (itself using the new format). Tests: unit (map + rewrite + renderInline) and integration (both render paths). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standardizes how wherefore items reference each other inside a body: a standard relative Markdown link to the target file, e.g.
[P-004: verified brokers](P-004-slug.md)or[Q-007: token store](../questions/Q-007-slug.md)— never a bare slug and never an Obsidian[[wikilink]]. Link text leads with the target ID.Why Markdown links (universal compatibility): they render as real links in GitHub, Obsidian, VS Code, and the dashboard. Wikilinks only resolve in the Obsidian family and show as literal text on GitHub — the opposite of the goal. Frontmatter refs (
decision_ref,question_ref,supersedes, …) stay bare; this standard is for body prose only. Captured as decision2026-07-19-markdown-crosslinks.The standard (docs + skills)
AGENTS.mdgains a canonical Linking section — andpackages/wherefore/bin/prepare-package.jspropagates it into the scaffolded template, so consuming repos get it.capture,slate,supersede,resolveskills +seed.md's embedded plan README +wherefore/plan/README.md+ aCLAUDE.mdpointer all teach the format.Dashboard renders the new links
The dashboard serves routes, not
.mdfiles, so.mdcross-links are rewritten at build time:src/lib/md-links.mjs— config-timefilename → routemap (basename-keyed;P-*/Q-*/date-slug names are disjoint) + purerewriteMdHref.renderInline, which gets the same rewrite and now protects link syntax shown inside code spans (so a`[label](x.md)`example stays literal instead of becoming a stray link).@astrojs/markdown-remark(a build-timedependency): Astro 7's default Markdown processor only runsrehypePluginswith it installed — Astro's own prescribed fix. Switches to the well-established unified processor; all prior tests still pass.Dogfood
- See also: <slug>lines to Markdown links.Tests & verification
buildMdLinkMap,rewriteMdHref,renderInlinemap + code-span protection) and integration (both render paths, via fixtures with relative.mdlinks).wherefore/data: cross-links resolve to/log/…routes; example links render as code; migratedSee alsolines are clickable.claude plugin validatepasses; the package regeneration propagates the Linking section.Notes / out of scope
/questions#Q-NNN) deferred — question links resolve to/questions.[[…]](e.g. inexpurge) left as-is: forward-only, no dashboard back-compat.🤖 Generated with Claude Code