HiLiteTag
Highlight and tag text inside complex HTML and Markdown.
On npmOpen source · published on npm
- Role
- Creator and maintainer
- When
- Jun 2025 – Aug 2025
- Context
- Open source · published on npm
- npm
2,100+ downloads on npm
All time, updated daily.
const tags = new HiLiteTags([
{
id: '1',
color: 'rgba(255,255,0,0.4)',
selectedColor: 'rgba(255,255,0,0.8)',
},
]);
<HiLiteContent ref={ref} tags={tags} autoWordBoundaries>
<p>Thank you for <b>supporting</b> this project.</p>
</HiLiteContent>HiLiteTag is a React component for highlighting and tagging text across nested HTML and Markdown. Tags can overlap, span several elements, carry their own colours and styles, and serialize so they can be stored and restored later.
What I did
- Handles selections that cross element boundaries by splitting one tag into linked markers that share an id.
- Supports overlapping tags, custom colours and styles, and selecting or removing a tag as a whole.
- Serializes tags with their offsets for storage and restores them when the content loads.
- Ships TypeScript types and a ref API to create, read, update, delete and restore tags.