@timlassiter11/yatl
    Preparing search index...

    Function highlightText

    • Slices a string and wraps matched search indices in a Lit TemplateResult.

      Parameters

      • text: string

        The original string to render.

      • Optionalranges: MatchIndex[]

        An array of {start, end} objects representing matches.

      • renderMatch: (match: string) => TemplateResult = ...

        Optional callback to define how the matched text is wrapped. Defaults to a tag.

      Returns string | TemplateResult

      A Lit TemplateResult, or the original string if no ranges exist.