Linux command
carbon-now 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Generate image from file
carbon-now [file.js]
Interactive mode
carbon-now [file.py] --interactive
Save to specific location
carbon-now [file.rs] --save-to [~/images]
Save with custom name
carbon-now [file.go] --save-as [my-code]
From clipboard
carbon-now --from-clipboard
Copy result to clipboard
carbon-now [file.ts] --to-clipboard
Use preset
carbon-now [file.js] --preset [my-preset]
Specific line range
carbon-now [file.py] --start [5] --end [15]
说明
carbon-now creates beautiful images of source code from the terminal using the Carbon service (carbon.now.sh). It renders code with syntax highlighting, customizable themes, and professional styling suitable for presentations, documentation, and social media. The tool uses a headless browser (Playwright) to render images through the Carbon web service. It supports reading from files, clipboard, or stdin, and can output to files or clipboard. Interactive mode allows customizing appearance settings before generating the image. Presets save frequently used configurations for consistent styling.
参数
- -i, --interactive
- Customize settings before generating
- -s, --start _line_
- Starting line of input
- -e, --end _line_
- Ending line of input
- -p, --preset _name_
- Apply existing preset
- --save-to _path_
- Image save location (default: cwd)
- --save-as _name_
- Image filename without extension
- --from-clipboard
- Read input from clipboard
- --to-clipboard
- Copy image to clipboard
- --open-in-browser
- Open in browser instead of saving
- --config _path_
- Use different config file
- --settings _json_
- Override specific settings
- --disable-headless
- Run browser in headful mode
- --engine _name_
- Rendering engine: chromium, firefox, or webkit (default: chromium)
- --skip-display
- Don't display the image in the terminal
FAQ
What is the carbon-now command used for?
carbon-now creates beautiful images of source code from the terminal using the Carbon service (carbon.now.sh). It renders code with syntax highlighting, customizable themes, and professional styling suitable for presentations, documentation, and social media. The tool uses a headless browser (Playwright) to render images through the Carbon web service. It supports reading from files, clipboard, or stdin, and can output to files or clipboard. Interactive mode allows customizing appearance settings before generating the image. Presets save frequently used configurations for consistent styling.
How do I run a basic carbon-now example?
Run `carbon-now [file.js]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i, --interactive do in carbon-now?
Customize settings before generating