MCPcopy
hub / github.com/codeaashu/claude-code / highlightPattern

Function highlightPattern

web/components/tools/ToolGrep.tsx:67–83  ·  view source on GitHub ↗
(text: string, pattern: string)

Source from the content-addressed store, hash-verified

65}
66
67function highlightPattern(text: string, pattern: string): React.ReactNode {
68 try {
69 const re = new RegExp(`(${pattern})`, "gi");
70 const parts = text.split(re);
71 return parts.map((part, i) =>
72 re.test(part) ? (
73 <mark key={i} className="bg-yellow-500/30 text-yellow-200 rounded-sm">
74 {part}
75 </mark>
76 ) : (
77 part
78 )
79 );
80 } catch {
81 return text;
82 }
83}
84
85export function ToolGrep({
86 input,

Callers 1

ToolGrepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected