MCPcopy Create free account
hub / github.com/Houseofmvps/codesight / stripCodeBlocks

Function stripCodeBlocks

src/detectors/knowledge.ts:151–157  ·  view source on GitHub ↗

* Strip fenced code blocks (``` ... ```) and inline `code` spans from markdown. * Prevents false positives when extracting questions, people, etc. from prose.

(content: string)

Source from the content-addressed store, hash-verified

149 * Prevents false positives when extracting questions, people, etc. from prose.
150 */
151function stripCodeBlocks(content: string): string {
152 // Remove fenced code blocks (``` ... ``` or ~~~ ... ~~~), including language tags
153 let stripped = content.replace(/^```[\s\S]*?^```/gm, "").replace(/^~~~[\s\S]*?^~~~/gm, "");
154 // Remove inline code spans (`...`)
155 stripped = stripped.replace(/`[^`\n]+`/g, "``");
156 return stripped;
157}
158
159// ─── Open Question Extraction ─────────────────────────────────────────────────
160

Callers 2

extractOpenQuestionsFunction · 0.85
extractPeopleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected