Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Line ¶
type Line struct {
Segments []Segment
}
Line represents a line of Output.
func (Line) ANSI ¶
ANSI returns the ANSI representation of the line written in true-color notation (24-bit).
func (Line) JS ¶
JS returns an unquoted JavaScript string of the ANSI output. The string is escaped to work inside either double or single quotes.
type Output ¶
type Output struct {
Lines []Line
}
Output represents the parsed HTML. See the Convert function.
func Center ¶
Center returns a slice of Output's centered together. If no outputs are at least minWidth in length, then they are centered using minWidth. It is valid to call this function with midWidth set to 0.
func Convert ¶
Convert converts HTML to an Output which can be used to extract ANSI or xterm.js strings.
Specifically, this function looks for <span> and <font> tags with "color" attributes or "style" attributes which specify a color. Tags surrounded in <div></div> are treated as individual lines and <br> creates a new line.
It's known to work with the HTML output of a few sites: - http://patorjk.com/text-color-fader/ - https://asciiart.club/ - https://www.text-image.com/convert/
func (Output) ANSI ¶
ANSI returns the ANSI representation of the output written in true-color notation (24-bit).
func (*Output) Center ¶
Center centers all lines using the specified width. If the Output's MaxLength is greater than or equal to width no change is made.
func (Output) JS ¶
JS returns an unquoted JavaScript string of the ANSI output. The string is escaped to work inside either double or single quotes.