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

Making some words in the text bold #89

Closed Blutude closed 5 years ago

Blutude commented 5 years ago

This issue is not about making the highlighted words bold.

I have my entire text to display and I hope to use this library because it helps with exactly what I need to do. Except I also need to make specific words bold in the string I am passing to this component.

For example my textToHighlight='Blue is my favorite color', my searchWords=['Blue']. For my result I want: 'Blue is my favorite color'. (assuming that blue is highlighted)

Is there a way for me to pass the string to textToHighlight containing information about which words need to be in bold? If not then I might not be able to use this package.

bvaughn commented 5 years ago

No, sorry. textToHighlight must be a string (markup isn't supported)