Function
highlightText
(text: string, highlights: string[])
Source from the content-addressed store, hash-verified
| 20 | }; |
| 21 | |
| 22 | const highlightText = (text: string, highlights: string[]) => { |
| 23 | const parts = text.split(new RegExp(`(${highlights.join('|')})`, 'gi')); |
| 24 | return parts.map((part, index) => |
| 25 | highlights.includes(part) ? <span key={index} className="text-primary-color underline">{part}</span> : part |
| 26 | ); |
| 27 | }; |
| 28 | |
| 29 | const paragraphs = description.split('\n'); |
| 30 | |
Tested by
no test coverage detected