(result: SearchResult)
| 468 | const excerptRadius = 60 |
| 469 | |
| 470 | const matcherOf = (result: SearchResult) => { |
| 471 | const terms = result.terms.filter(Boolean) |
| 472 | return terms.length ? |
| 473 | new RegExp( |
| 474 | `(${terms.map(term => term.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")).join("|")})`, |
| 475 | "gi" |
| 476 | ) |
| 477 | : undefined |
| 478 | } |
| 479 | |
| 480 | const marked = (text: string, matcher: RegExp | undefined): ReactNode => |
| 481 | matcher ? |