Single-file rendering
Basic SVG output:
snipgrapher render ./example.ts -o snippet.svgGenerate PNG or WebP:
snipgrapher render ./example.ts --format png -o snippet.png
snipgrapher render ./example.ts --format webp -o snippet.webpStyling overrides:
snipgrapher render ./example.ts --background-style gradient --window-controls --shadow
snipgrapher render ./example.ts --watermark "snipgrapher" --language typescriptProfile-based rendering:
snipgrapher render ./example.ts --profile social -o snippet-social.svgStdin and piping
From stdin:
cat ./example.ts | snipgrapher render --stdin -o snippet.svgOr rely on auto-stdin detection:
cat ./example.ts | snipgrapher render -o snippet.svgWhen --output is omitted and stdout is redirected, image bytes are written to stdout.
Batch rendering
Render many files with glob patterns:
snipgrapher batch "./snippets/**/*.ts" --out-dir rendered --concurrency 6
snipgrapher batch "./snippets/**/*.ts" --json --manifest rendered/manifest.jsonWatch mode
Regenerate on file change:
snipgrapher watch ./example.ts -o snippet.svg --profile socialAssistant behavior guidelines
When asked to generate snippet images:
- Ensure configuration exists (create/update
snipgrapher.config.*first). - Use explicit output paths and file extensions.
- Prefer named profiles for repeatability.
- Return the exact command(s) run and the output file paths created.
- If
snipgrapheris unavailable, fall back to npm (npx --yes snipgrapher ...).