feat: extract paths

This commit is contained in:
tomasz-io 2025-04-03 09:20:41 -07:00
parent f95cdfaf83
commit 2ffb4aefeb

View file

@ -0,0 +1,16 @@
/**
* Extracts file paths from markdown code blocks
*/
export function extractPathsFromCodeBlocks(content: string): string[] {
const codeBlockRegex = /```[\w-+#]*\s+([^\s(]+)(?:\s|$|\()/g;
const paths: string[] = [];
let match;
while ((match = codeBlockRegex.exec(content)) !== null) {
if (match[1]) {
paths.push(match[1]);
}
}
return paths;
}