export interface AnchorScope { /** Heading ids of the page being checked, as the renderer emitted them. */ selfIds: ReadonlySet; /** This guide's directory name, used to resolve self- and sibling links. */ topic?: string; /** topic slug -> that guide's heading ids. Omit a topic to skip checking it. */ idsByTopic?: ReadonlyMap>; } /** * Return the link targets in `markdown` whose `#fragment` matches no heading id * on the page it points at. * * **The ids are supplied, never re-derived.** `buildGuide` passes the `headings` * that `renderGuideBody` actually produced, after every remark plugin has run. * An earlier version recomputed slugs here from a bare `remark-parse` tree; that * silently disagreed with the renderer for any heading containing a text * directive (`## The :sev[P0]{level=p0} rule` renders `id="the-p0-rule"` but * re-parsing yielded `the-sevp0levelp0-rule`), which both rejected correct * anchors and accepted wrong ones. Taking the ids from the renderer removes that * whole class of drift rather than patching one instance of it. * * Consequences of having no filesystem access here: a missing or unbuilt target * cannot crash the check, and a topic absent from `idsByTopic` is skipped rather * than guessed at. Links outside the guides tree (`../../docs/x.md#y`) are also * skipped — those files are rendered by a different slugger, so judging them by * this one would be wrong in both directions. * * A missing target *file* is not reported here; `findBrokenRelativeLinks` owns * that, and reporting it twice would double the build error. */ export declare function findBrokenAnchors(markdown: string, scope: AnchorScope): string[]; /** * Return the targets of relative links/images/reference-definitions in * `markdown` that do not resolve on disk relative to `guideDir`. * * Parses the markdown body (frontmatter stripped) to an mdast and inspects only * `link`, `image`, and `definition` nodes, so link-like text in code blocks, * inline code, or frontmatter is never flagged, and reference-style links are * covered. External URLs (`http:`, `mailto:`, …), protocol-relative (`//`), and * pure anchors (`#…`) are ignored. A trailing `#anchor` is stripped and the * target is percent-decoded before resolving. A `…/index.html` link is accepted * when the `index.md` source exists (the HTML may not be built yet, e.g. a stub). */ export declare function findBrokenRelativeLinks(markdown: string, guideDir: string): string[]; //# sourceMappingURL=links.d.ts.map