mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* fix: add second param to `each` in `MarkOptions` * fix: separate MarkRangesOptions similar to MarkRegExOptions
27 lines
638 B
TypeScript
27 lines
638 B
TypeScript
import * as Mark from 'mark.js';
|
|
|
|
/* test instance */
|
|
const mark = new Mark(document.querySelectorAll('div'));
|
|
const markBySelector = new Mark('div');
|
|
const markByElement = new Mark(document.body);
|
|
|
|
mark.mark('keyword');
|
|
mark.mark('keyword', {
|
|
element: "span",
|
|
className: "highlight"
|
|
});
|
|
mark.mark(['keyword1', 'keyword2']);
|
|
mark.markRegExp(/regex/, {className: 'highlight'});
|
|
mark.markRanges([{start: 0, length: 10}], {
|
|
className: 'highlight',
|
|
each: (el: Element, range: Mark.Range) => {
|
|
el.id = '';
|
|
}
|
|
});
|
|
|
|
/* test jquery */
|
|
$("div.context").mark("text", {
|
|
element: "span",
|
|
className: "highlight"
|
|
});
|