Use this file to discover all available pages before exploring further.
advanced-mark.js ships TypeScript declaration files inside the dist/ folder of the npm package. Both the vanilla JavaScript and jQuery plugin builds are covered, in both CommonJS and ES6 module flavours.
TypeScript resolves the correct declaration file automatically when you import from 'advanced-mark.js' (maps to mark.es6.js + mark.es6.d.ts). For other builds you must supply the full path.
// Automatically resolves to mark.es6.js + mark.es6.d.tsimport Mark from 'advanced-mark.js';const instance = new Mark(document.querySelector('article'));instance.mark('lorem ipsum', { caseSensitive: false, separateWordSearch: true,});
Callbacks receive typed info objects that expose match metadata and an abort flag:
interface MarkFilterInfo { match: RegExpExecArray; // the raw RegExp match matchStart?: boolean; // true when this is the first node of a cross-element match count: number; // matches encountered so far for this term abort: boolean; // set to true to halt processing immediately}interface MarkEachInfo { match: RegExpExecArray; matchStart?: boolean; count: number; abort: boolean;}interface RegExpFilterInfo { match: RegExpExecArray; matchStart?: boolean; count: number; groupIndex?: number; abort: boolean;}interface RegExpEachInfo { match: RegExpExecArray; matchStart?: boolean; count: number; groupIndex?: number; groupStart?: boolean; abort: boolean;}// TermStats maps each search term to its match countinterface TermStats { [term: string]: number;}// Passed as the third argument of the each() callback in markRanges()interface RangeEachInfo { matchStart?: boolean; count: number;}