Just saw this High-Performance Syntax Highlighting with CSS Highlights API
and it looks super cool
These limitations may make this worse than what we have now though ![]()
From the post:
Text Nodes Only: Only works with plain text content
Single Text Node: The highlighted element must contain a single text node
Static Ranges: Ranges don’t automatically update if text content changes
Older Browsers: Requires fallback for browsers older than Chrome 105, Firefox 140, or Safari 17.2