JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5930
  • Score
    100M100P100Q134655F
  • License MIT

Highlight words, terms, or text on browser page using JavaScript.

Package Exports

  • advanced-mark.js
  • advanced-mark.js/dist/mark.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (advanced-mark.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

advanced-mark.js

npm

Highlight words, terms, or text on browser page using JavaScript.

To play with this library - advanced-mark.js-playground. It requires minimum installation and provides full functionality. It also can be used with the old mark.js - it's install npm package v8.11.1. It has some built-in examples.

What is done:

  • filter, each, and done callbacks have received additional parameters; they expose useful information that can simplify the code, help solve problems which are difficult or not possible to implement externally.
  • The acrossElements option - advance across elements pipeline, which boosts performance (also affects markRanges() method), allows correctly highlight (especially minified) HTML with the requirement exactly in mark() or markRegExp() methods ...
  • combinePatterns option - boosts performance of mark() method when highlighting array
  • cacheTextNodes option - improves performance of mark() method when highlighting array
  • separateGroups option - allows highlighting RegExp capturing groups instead of the whole match, handle RegExp with/without the d flag
  • wrapAllRanges option - allows highlighting nesting/overlapping ranges and RegExp capturing groups
  • blockElementsBoundary option - limits matches within HTML block elements, when highlighting phrases or RegExp groups with acrossElements option
  • shadowDOM option - allows highlighting shadow DOM ('mode: open' and is already built)

This library keeps backward compatibility with mark.js v9.0.0 and npm package v8.11.1 on public API level.

Documentation. Note that this doc is for mark.js, it isn't updated for a long time.

Version 1 doc content

Modules changes

  • *. es6.*.js now are real ES6 modules
  • *.umd.*.js are UMD modules, previously was named as *. es6.*.js
import Mark from './mark.es6.js';
// import Mark from './jquery.mark.es6.js';

Warning: UMD modules will be removed in version 2 - they are kept for backward compatibility.