(html, symbol)
| 28 | } |
| 29 | |
| 30 | function addSymbolHighlight(html, symbol) { |
| 31 | if (!symbol) return html; |
| 32 | const escapedSymbol = escapeRegExp(sanitize(symbol)); |
| 33 | const regex = new RegExp(`(${escapedSymbol})`, "gi"); |
| 34 | return html.replace(regex, '<span class="symbol-match">$1</span>'); |
| 35 | } |
| 36 | |
| 37 | function setCache(key, value) { |
| 38 | if (highlightCache.size >= MAX_CACHE_SIZE) { |
no test coverage detected