carbon-app / carbon

:black_heart: Create and share beautiful images of your source code
https://carbon.now.sh
MIT License
34.68k stars 1.92k forks source link

carbon sdk #1503

Open am29d opened 9 months ago

am29d commented 9 months ago

Is your feature request related to a problem? Please describe. We use carbon of our open source project to generate images for documentation, GitHub releases or presentations. We support multiple languages and have various features we want to highlight using carbon generate images. Over time our collection of examples grows and it becomes hard to generate them manually. We want to have a single project with all example files in a specific language. Right now, we need to generate images manually (online or offline as PWA).

There are cases we want to update the generated images across documents due to API changes, errors, or minor tweaks. In this case we'd need to render all examples manually through the website. I can also see other users who don't want to send the code over wire and prefer to render locally (which they can with PWA).

Describe the solution you'd like I'd like to have a carbon SDK that allows me generate images from projects or folders locally. I would run npm run carbon generate myproject. The SDK will scan the directory, and generate images using carbon.conf.json in this project.

Describe alternatives you've considered I looked at https://github.com/mixn/carbon-now-cli which is a playwright automation wrapper around the website.

Additional context