bvaughn / bvaughn/react-highlight-words
Pass `searchIndex` (index of matched `searchWords`) to `highlightTag`
- Dominant language
- JavaScript
- Stars
- 2.3k
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
I'd like to highlight words based on some conditional logic, and it'd be handy to have the original index in `searchWords` where the current highlight was matched.
For cases where matching is simple strict string equality, yes it's easy to just do `searchWords.indexOf`, but this could get more complicated with `autoEscape`/`caseSensitive`/etc. and could require us to re-implement logic the library is already doing internally but not exposing.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the highlightTag callback and trace the matching logic that identifies each searchWords match, including autoEscape and caseSensitive behavior. Confirm how the original searchWords index can be carried through to the callback, then use the existing test setup to verify the callback receives the correct index for matched words.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100