vcp-md
v1.0.0
Published
Extract and write code blocks from Markdown files — path defined by backtick-quoted filename before each fenced block
Downloads
118
Maintainers
Readme
vcp — Vitalize Code from Markdown
Reads a .md file, finds every fenced code block preceded by a backtick-quoted file path, and writes each block to disk.
Install
npm install -g vcpOr link locally during development:
cd /path/to/vcp
npm linkUsage
vcp path/to/project.md # extract & write all files
vcp --dry-run path/to/file.md # preview without writing
vcp --helpMarkdown format
Place the file path (in backticks) on any line immediately before the opening fence. Blank lines between the path and the fence are allowed. Everything else — prose, regular headings, bullet points — is ignored.
Minimal
`src/index.js`
```js
console.log('hello');
```In a heading
### `src/utils/math.ts`
```ts
export const add = (a: number, b: number) => a + b;
```With blank line between path and fence
`config/settings.json`
```json
{ "debug": true }
```Nested paths — directories are created automatically
`packages/core/src/index.ts`
```ts
export * from './lib';
```Rules
- The path line must contain exactly one backtick-quoted token.
- The token must look like a file path: contains
/, starts with./or../, or matchesname.ext. - Tokens with spaces are ignored (treated as inline prose code).
- All other text between code blocks is silently skipped.
