Carbonara
API for carbon.
Getting started
Send POST https://carbonara-42.herokuapp.com/api/cook
to take an image of code snippet.
How it works
- Puppeteer visit https://carbon.now.sh.
- Mapping all params in properly URL params.
- Taking a screenshot of the editor.
POST /api/cook
Body is JSON or multipart with next params:
parameter | default | type | description |
---|---|---|---|
code (required) |
string | code snippet | |
backgroundColor |
"rgba(171, 184, 195, 1)" |
string | hex or rgba color |
dropShadow |
true |
boolean | turn on/off shadow |
dropShadowBlurRadius |
"68px" |
string | shadow blur radius |
dropShadowOffsetY |
"20px" |
string | shadow offset y |
exportSize |
"2x" |
string | resolution of exported image, e.g. 1x , 3x
|
fontCustom |
"" |
string | custom woff font's contents, encoded in base64 |
fontSize |
"14px" |
string | font size |
fontFamily |
"Hack" |
string | font family, e.g. JetBrains Mono , Fira Code . See all names in carbon exported config. |
firstLineNumber |
1 |
number | first line number |
language |
"auto" |
string | programing language for properly highlighting. See name in carbon exported config |