A simple tool for opening any textual content with Carbon.
It allows for custom JSON configurations, and it features UNIX-style composability.
$ carbonize example.go # A new tab will open in your default browser.
$ cat example.go | carbonize # This is equivalent to the previous command.
$ carbonize -c my-config.json example.go # Use a custom configuration.
On Windows, Linux, and macOS, you can use the pre-built binaries.
If your system has Go 1.18+, you can build from source.
go install interrato.dev/carbonize/cmd/...@latest
Help from new packagers is very welcome.
Usage:
carbonize [-c PATH] [INPUT]
Options:
-c, --configuration PATH Use PATH as a configuration file.
-n, --trailing-newline Keep the trailing newline if it exists.
INPUT defaults to standard input.
A configuration file must be a JSON file. Ideally, it should be a configuration
exported from the Carbon website.
Keep in mind that due to browser limitations and other factors, a maximum input length do exists. The current value used by carbonize is 45580 characters after URL-encoding.
Run carbonize on an example Go source code file.
$ carbonize example.go
The browser opens, then I modify the comment text color to yellow, and the following image is the result. ✨
You can easily run carbonize on GitHub raw source files by combining it with curl
.
$ curl -s https://raw.githubusercontent.com/BuriedInTheGround/fine/main/fine.go | carbonize