UNPKG

js-text-highlighter

Version:

A framework-agnostic text highlighting library that supports virtualized texts

24 lines (23 loc) 873 B
import { HighlightOptions } from "./Highlighter"; /** * Creates a highlighter instance and provides methods for highlighting text in elements. * @param options The highlight options to configure the highlighter. * @returns An object with methods to control the highlighter. */ export declare function createHighlighter(options: HighlightOptions): { /** * Highlights the provided element or selector. * @param element The element or selector to highlight. */ highlight: (element: HTMLElement | string) => void; /** * Updates the options used by the highlighter. * @param newOptions The new options to update. */ updateOptions: (newOptions: Partial<HighlightOptions>) => void; /** * Destroys the highlighter instance and stops observing changes. */ destroy: () => void; }; export type { HighlightOptions };