Categorygithub.com/robert-nix/ansihtml
modulepackage
1.0.1
Repository: https://github.com/robert-nix/ansihtml.git
Documentation: pkg.go.dev

# README

ansihtml

Travis codecov PkgGoDev

Go package to parse ANSI escape sequences to HTML.

Usage

html := ansihtml.ConvertToHTML([]byte("\x1b[33mThis text is yellow.\x1b[m"))
// html: `<span style="color:olive;">This text is yellow.</span>`

html := ansihtml.ConvertToHTMLWithClasses([]byte("\x1b[31mThis text is red."), "ansi-", false)
// html: `<span class="ansi-fg-red">This text is red.</span>`

# Functions

ConvertToHTML converts ansiBytes to HTML where ANSI escape sequences have been translated to <span> tags with appropriate style attributes.
ConvertToHTMLWithClasses converts ansiBytes to HTML where ANSI escape sequences have been translated to <span> tags with appropriate classes set.
NewParser creates a Parser which reads from rd and writes output with escape sequences removed to w.

# Structs

Parser parses ANSI-encoded console output from an io.Reader.