MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / addSymbolHighlight

Function addSymbolHighlight

src/utils/codeHighlight.js:30–35  ·  view source on GitHub ↗
(html, symbol)

Source from the content-addressed store, hash-verified

28}
29
30function 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
37function setCache(key, value) {
38 if (highlightCache.size >= MAX_CACHE_SIZE) {

Callers 1

highlightLineFunction · 0.85

Calls 2

escapeRegExpFunction · 0.70
sanitizeFunction · 0.70

Tested by

no test coverage detected