formatDeadLink #
Formats a dead link as one report line, source:line href reason, the way build and dev print it.
Usage #
TypeScript
import { formatDeadLink } from 'kawapress'
const line = formatDeadLink({
href: './b.md',
target: '/b',
source: '/a.md',
line: 3,
reason: 'missing-page',
})Parameters
linkDeadLink
The dead link.
hrefstring
Original href from the Markdown source, for example ./intro.md#setup.
targetstring
Public route or public file path without the site base, including search and hash.
sourcestring
Source path relative to srcDir, for example /guide/intro.md.
linenumber
1-based line number of the Markdown block that contains the link.
reasonDeadLinkReason
Why the link is dead.
Returns The report line.
Full type signature
TypeScript
function formatDeadLink(link: DeadLink): string

Comments