Goal
Set up snipgrapher so snippet rendering is deterministic and easy to repeat.
1) Pick an executable strategy
Use one of these:
- Binary available in PATH:
snipgrapher - npm package without global install:
npx --yes snipgrapher doctor2) Initialize configuration
Create a baseline config in the current project:
snipgrapher initSupported config filenames (first match wins):
snipgrapher.config.jsonsnipgrapher.config.yamlsnipgrapher.config.ymlsnipgrapher.config.toml
3) Define reusable defaults and profiles
Use a config structure like:
{
"theme": "nord",
"fontFamily": "Fira Code",
"fontSize": 14,
"padding": 32,
"lineNumbers": true,
"windowControls": true,
"shadow": true,
"backgroundStyle": "gradient",
"format": "svg",
"defaultProfile": "default",
"profiles": {
"default": {},
"social": {
"padding": 48,
"fontSize": 16,
"watermark": "@your-handle"
}
}
}4) Validate environment and config
Run:
snipgrapher doctor
snipgrapher themes listFix validation errors before rendering.
5) Understand precedence for overrides
Rendering values resolve as:
CLI flags > environment variables > config file > defaults
Useful env vars include:
SNIPGRAPHER_PROFILESNIPGRAPHER_THEMESNIPGRAPHER_FORMATSNIPGRAPHER_FONT_SIZESNIPGRAPHER_PADDINGSNIPGRAPHER_LINE_NUMBERS
Use env vars for CI-wide defaults, and CLI flags for one-off overrides.