Configures and uses snipgrapher to generate polished code snippet images, including syntax-highlighted PNGs, SVGs, and WebP exports with custom themes, profiles, and styling options. Use when the user wants to create code screenshots, turn code into shareable images, generate pretty code snippets for docs or social posts, produce syntax-highlighted images from source files, or explicitly mentions snipgrapher. Supports single-file renders, batch jobs, watch mode, and reusable named profiles via the snipgrapher CLI or npx.
97
97%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
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.svgFrom 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.
Render many files with glob patterns:
snipgrapher batch "./snippets/**/*.ts" --out-dir rendered --concurrency 6
snipgrapher batch "./snippets/**/*.ts" --json --manifest rendered/manifest.jsonRegenerate on file change:
snipgrapher watch ./example.ts -o snippet.svg --profile socialWhen asked to generate snippet images:
snipgrapher.config.* first).snipgrapher is unavailable, fall back to npm (npx --yes snipgrapher ...).