carbonize

module
v1.0.0-beta1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2022 License: BSD-3-Clause

README

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.

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

Installation

If your system has Go 1.18+, you can build from source:

git clone https://interrato.dev/carbonize && cd carbonize
go build -o . interrato.dev/carbonize/cmd/...

Directories

Path Synopsis
cmd
carbonize command
internal
carbonize
Package carbonize implements utilities to deal with [Carbon] configurations and ease interactions with its website.
Package carbonize implements utilities to deal with [Carbon] configurations and ease interactions with its website.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL