MCPcopy
hub / github.com/CodebuffAI/codebuff / cleanMarkdownCodeBlock

Function cleanMarkdownCodeBlock

common/src/util/file.ts:285–290  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

283 * Removes markdown code block syntax if present, including any language tag
284 */
285export const cleanMarkdownCodeBlock = (content: string): string => {
286 const cleanResponse = content.match(/^```(?:[a-zA-Z]+)?\n([\s\S]*)\n```$/)
287 ? content.replace(/^```(?:[a-zA-Z]+)?\n/, '').replace(/\n```$/, '')
288 : content
289 return cleanResponse
290}
291
292export function isValidFilePath(path: string) {
293 if (!path) return false

Callers 2

processFileBlockFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected