Skip to content
🌈💻🎨 A tiny markup language for terminal output. Makes formatting output in CLI apps easier!
Branch: master
Clone or download
Latest commit 9825b59 May 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_examples/basic Initial commit May 2, 2019
tml Initial commit May 2, 2019
version Initial commit May 2, 2019
.gitignore Initial commit May 2, 2019
.travis.yml Initial commit May 2, 2019
LICENSE Create LICENSE May 13, 2019
Makefile Initial commit May 2, 2019
README.md Initial commit May 2, 2019
example.png Initial commit May 2, 2019
go.mod Initial commit May 2, 2019
go.sum Initial commit May 2, 2019
parse.go Initial commit May 2, 2019
parse_test.go Initial commit May 2, 2019
parser.go Add Println May 4, 2019
parser_test.go Initial commit May 2, 2019
printf.go
println.go Add Println May 4, 2019
sprintf.go Initial commit May 2, 2019
tags.go Add Println May 4, 2019

README.md

tml - Terminal Markup Language

Build Status GoDoc

A Go module (and standalone binary) to make the output of coloured/formatted text in the terminal easier and more readable.

You can use it in your Go programs, and bash etc. too.

Example screenshot

Usage in Go

The output of coloured/formatted text is easy using the following syntax:

package main

import "github.com/liamg/tml"

func main() {
    tml.Printf("<red>this text is <bold>red</bold></red> and the following is <green>%s</green>\n", "not red")
}

Usage in Bash

First, install tml:

go get -u github.com/liamg/tml/tml

Then you can simply pipe text containing tags to tml:

#!/bin/bash

echo "<red>this text is <bold>red</bold></red> and the following is <green>not red</green>" | tml

Format

Each tag is enclosed in angle brackets, much like HTML.

You can nest tags as deeply as you like.

It's not required to close tags you've opened, though it can make for easier reading.

Available Tags

Foreground Colours

  • <red>
  • <green>
  • <yellow>
  • <blue>
  • <magenta>
  • <cyan>
  • <lightgrey>
  • <darkgrey>
  • <black>
  • <white>
  • <lightred>
  • <lightgreen>
  • <lightyellow>
  • <lightblue>
  • <lightmagenta>
  • <lightcyan>

Background Colours

  • <bg-red>
  • <bg-green>
  • <bg-yellow>
  • <bg-blue>
  • <bg-magenta>
  • <bg-cyan>
  • <bg-lightgrey>
  • <bg-darkgrey>
  • <bg-black>
  • <bg-white>
  • <bg-lightred>
  • <bg-lightgreen>
  • <bg-lightyellow>
  • <bg-lightblue>
  • <bg-lightmagenta>
  • <bg-lightcyan>

Attributes

  • <bold>
  • <dim>
  • <underline>
  • <blink>
  • <reverse>
  • <hidden>
You can’t perform that action at this time.