bvaughn / react-highlight-words

React component to highlight words within a larger body of text
https://bvaughn.github.io/react-highlight-words/
MIT License
2.16k stars 170 forks source link

Passing additional information to findChunks #115

Open mgoldenbe opened 9 months ago

mgoldenbe commented 9 months ago

I am highlighting matching terms in lines of text. For my layout, each line needs to be rendered separately, so I have one <Highlighter> per line. Furthermore, I need to highlight a term even if it spans more than a single line. To do this, I need to pass the previous and the next line as additional context for findChunks to work with. How can this be achieved?

sergei-startsev commented 9 months ago
<Highlighter findChunks={(...args) => customFindChunk(...args, additionalContext)}/>