findPageDeadLinks #
Checks the links of one page the way findDeadLinks does.
Usage #
TypeScript
import { findPageDeadLinks } from 'kawapress'
const dead = findPageDeadLinks(
{ route: '/a', source: '/a.md', headings: [], links: [] },
{ routes: ['/a'], headings: new Map(), publicFiles: [] },
)Parameters
pagePageLinks
The links and heading anchors of the page.
routestring
Public route of the page, for example /guide/intro.
sourcestring
Source path relative to srcDir, for example /guide/intro.md.
headingsreadonly string[]
Anchor IDs of every heading on the page, from h1 to h6.
linksreadonly LinkRecord[]
Internal links written in the page.
siteDeadLinkSite
The routes, heading anchors and public files the links can point to.
routesIterable<string>
Public routes of every page in the site.
headingsReadonlyMap<string, readonly string[]>
Heading IDs of each page, keyed by route.
publicFilesIterable<string>
Files in the public directory, as paths relative to it, for example /logo.png.
ignoreoptionalreadonly DeadLinkIgnore[]
Links to skip.
default []
Returns The dead links of the page.
Full type signature
TypeScript
function findPageDeadLinks(
page: PageLinks,
site: DeadLinkSite,
ignore?: readonly DeadLinkIgnore[],
): DeadLink[]

Comments