ProseA
A link, resolved against the source it was written in.
Every link in a Markdown page passes through this component.
What it adds
A documentation path is rewritten to carry the prefix of the source the page came from, plus the reader's locale. An external URL is left alone and gets the new tab and the arrow.
Why
Markdown has no idea it is being served under a prefix. /getting-started
written in this repository's docs/ is correct on a site with one source and a
404 on a site with two, where the same page lives at /duxt/getting-started —
and the author of the Markdown, who may be another repository entirely, cannot
know which.
Worse, the same file is served at several prefixes at once when it is published
at more than one version: a link cannot be rewritten at build time, because there
is no single right answer. It is resolved per render instead, against the source
the page is being read from — so a link inside v0.7.0 keeps the reader in
v0.7.0.
API
Props
| Prop | Type | Notes |
|---|---|---|
href | string | As written in the Markdown |
target | string | Set for an external link |