Terminal: Open source ANSI to HTML renderer

Today, we're open sourcing Terminal, the Ruby library behind our rendering of job logs.

$ gem install terminal

Terminal makes it easy to take arbitrary shell output, and turn it into beautifully rendered HTML. It has a simple API:

require "terminal"

Terminal also ships with a command line utility, making it easy to test what the output will look like from the command line. For example, you can pipe rspec output to it:

$ rspec --color --tty | terminal

This will output the rendered HTML. That's not very useful by itself, but if you pass the --preview flag, it will render the output in a browser for you to view.

$ rspec --color --tty | terminal --preview

If some of your job logs look weird on Buildkite, you can use Terminal to help us debug the problem. First install jq, if you have Homebrew installed, you can just brew install jq.

Then, you can:

echo $(curl -H "Authorization: Bearer [api-key]" $JOB_LOG_URL -s | jq '.content') | terminal

Once you've identified a problem, submit an issue, or if you're feeling adventurous, submit a Pull Request and contribute to Buildbox! :)

For more information on the Buildbox Builds API, see: https://buildkite.com/docs/api/builds.

You can check out Terminal on our GitHub repository: https://github.com/buildkite/terminal-to-html/.

Why Buildkite?

Buildkite is the fastest, most secure way to test and deploy code at any scale.

Our self-hosted agents work in your environment with any source code tool, platform and language including but not limited to Ruby, Xcode, Go, Node, Python, Java, Haskell, .NET or pre-release tools.

See more features →

Two people launching a pod

Start Trial

Sign up for a free trial now
and connect your first agent.

Start Trial →