markmv - v1.39.2
    Preparing search index...

    Function suggestLinkFixes

    • 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.

      Parameters

      • brokenHref: string

        The broken link target as written

      • sourceFilePath: string

        Absolute path of the file containing the broken link

      • knownFiles: string[]

        Absolute paths of every candidate file in the project

      • limit: number = 3

        Maximum number of suggestions to return (default 3)

      Returns LinkSuggestion[]

      Ranked suggestions, best first; empty when nothing is reasonably similar


      if (suggestions.length > 0) { console.log(`Did you mean ${suggestions[0]?.replacementHref}?`); }