Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Enterprise Open source

findHighlightChunksInText() function

findHighlightChunksInText() function

Adapt findMatchesInText for react-highlight-words findChunks handler. See https://github.com/bvaughn/react-highlight-words#props

Signature

typescript
export declare function findHighlightChunksInText({ searchWords, textToHighlight, }: {
    searchWords: Array<string | RegExp>;
    textToHighlight: string;
}): TextMatch[];

Import

typescript
import { findHighlightChunksInText } from '@grafana/data';

Parameters

ParameterTypeDescription
{ searchWords, textToHighlight, }{
searchWords: Array<string | RegExp>;
textToHighlight: string;
}

Returns:

TextMatch[]