/** * A candidate replacement for a broken link target. * * @category Core */ export interface LinkSuggestion { /** Absolute path of the candidate file */ candidatePath: string; /** Replacement href, relative from the linking file and ./-prefixed, matching markmv conventions */ replacementHref: string; /** Human-readable reason this candidate ranked, for display in fix prompts */ reason: string; } /** * Suggest likely-intended targets for a broken link. * * Ranks every known file against the broken target by normalised name: an exact normalised stem * match wins, separator and case variations come next, then near misses by edit distance bounded * relative to the target's length so unrelated names are never suggested. The replacement href is * computed relative to the linking file, ./-prefixed like markmv's own rewrites, with posix * separators for markdown portability. * * @example * ```typescript const suggestions = suggestLinkFixes('./Getting-Started.md', sourceFile, knownFiles); * * if (suggestions.length > 0) { console.log(`Did you mean ${suggestions[0]?.replacementHref}?`); } ``` * * @param brokenHref - The broken link target as written * @param sourceFilePath - Absolute path of the file containing the broken link * @param knownFiles - Absolute paths of every candidate file in the project * @param limit - Maximum number of suggestions to return (default 3) * * @returns Ranked suggestions, best first; empty when nothing is reasonably similar */ export declare function suggestLinkFixes(brokenHref: string, sourceFilePath: string, knownFiles: string[], limit?: number): LinkSuggestion[]; //# sourceMappingURL=link-suggester.d.ts.map