Skip to content

A simple CLI tool for opening any textual content with Carbon.

License

Notifications You must be signed in to change notification settings

BuriedInTheGround/carbonize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

carbonize

Go Reference

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.

Installation

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

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.

Example

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. ✨

The source code of a Go program which runs an HTTP server on port 8080 that randomly uses or not TLS.

Carbonize GitHub source files

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

About

A simple CLI tool for opening any textual content with Carbon.

Topics

Resources

License

Stars

Watchers

Forks

Languages