MCPcopy Index your code
hub / github.com/AbhinavTheDev/coding-agent / formatMessageWithCode

Function formatMessageWithCode

ui/app/components/chatInterface.tsx:128–155  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

126}
127
128function formatMessageWithCode(content: string) {
129 const parts = content.split(/(```[\s\S]*?```)/);
130 return (
131 <div className="space-y-2">
132 {parts.map((part, index) => {
133 if (part.startsWith('```') && part.endsWith('```')) {
134 const code = part.slice(3, -3);
135 const language = code.split('\n')[0].trim();
136 const codeContent = code.substring(language.length).trim();
137
138 return (
139 <SyntaxHighlighter
140 key={index}
141 language={language || 'javascript'}
142 style={oneDark}
143 className="rounded-md text-sm"
144 >
145 {codeContent}
146 </SyntaxHighlighter>
147 );
148 }
149 return (
150 <p key={index} className="text-sm">{part}</p>
151 );
152 })}
153 </div>
154 );
155}

Callers 1

ChatInterfaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected