advanced-mark.js is a high-performance JavaScript library for highlighting arbitrary text, search terms, regular expressions, and character ranges directly in the browser DOM. It extends and significantly improves upon the original mark.js, adding CSS Custom Highlight API support, cross-element matching, shadow DOM and iframe traversal, and much faster performance across large documents.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/angezid/advanced-mark.js/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Learn what advanced-mark.js does and how it compares to mark.js
Quickstart
Install the library and highlight your first text in minutes
API Reference
Full reference for mark(), markRegExp(), markRanges(), and unmark()
Guides
Deep dives into filtering, groups, overlapping ranges, and more
Key Features
CSS Custom Highlight API
Use native browser highlights via StaticRange/Range objects — no DOM mutations needed
Cross-Element Matching
Find matches that span multiple HTML elements with the
acrossElements optionShadow DOM & iframes
Traverse open shadow roots and same-origin iframes to highlight inside them
Separate Group Highlighting
Highlight individual RegExp capturing groups independently using the
d flagNesting & Overlapping
Mark nested and overlapping ranges or match groups with
wrapAllRangesjQuery Plugin
Drop-in jQuery plugin build alongside the vanilla JS and ES6 module builds