ansi

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

nolint:golint

Index

Constants

View Source
const (
	MDTERM_USE_ANSI = 1 << iota // use ANSI sequences
)

Markdown terminal renderer configuration options.

Variables

View Source
var DisableColors = false

DisableColors disables all colors and other ANSI sequences.

View Source
var EnvironmentOverrideColors = true

EnvironmentOverrideColors overs coloring based on `CLICOLOR` and `CLICOLOR_FORCE`. Cf. https://bixense.com/clicolors/

View Source
var ForceColors = false

ForceColors forces the use of colors and other ANSI sequences.

Functions

func Bold added in v0.2.1

func Bold(text string) string

Bold returns bolded text if the writer supports colors

func Color

func Color(w io.Writer) aurora.Aurora

Color returns an aurora.Aurora instance with colors enabled or disabled depending on whether the writer supports colors.

func ColorizeJSON

func ColorizeJSON(json string, darkStyle bool, w io.Writer) string

ColorizeJSON returns a colorized version of the input JSON, if the writer supports colors.

func ColorizeStatus added in v0.6.3

func ColorizeStatus(status int) aurora.Value

ColorizeStatus returns a colorized number for HTTP status code

func Faint added in v0.2.1

func Faint(text string) string

Faint returns slightly offset color text if the writer supports it

func Italic added in v0.2.1

func Italic(text string) string

Italic returns italicized text if the writer supports it.

func Linkify

func Linkify(text, url string, w io.Writer) string

Linkify returns an ANSI escape sequence with an hyperlink, if the writer supports colors.

func MarkdownTermRenderer added in v0.5.2

func MarkdownTermRenderer(flags int) blackfriday.Renderer

MarkdownTermRenderer creates and configures a MarkdownTerm object, which satisfies the Renderer interface.

flags is a set of MDTERM_* options ORed together.

func StartSpinner

func StartSpinner(msg string, w io.Writer) *spinner.Spinner

StartSpinner starts a spinner with the given message. If the writer doesn't support colors, it simply prints the message.

func StopSpinner

func StopSpinner(s *spinner.Spinner, msg string, w io.Writer)

StopSpinner stops a spinner with the given message. If the writer doesn't support colors, it simply prints the message.

func StrikeThrough added in v0.5.2

func StrikeThrough(text string) string

StrikeThrough returns struck though text if the writer supports colors

Types

type MarkdownTerm added in v0.5.2

type MarkdownTerm struct {
	// contains filtered or unexported fields
}

MarkdownTerm is a type that implements the blackfriday.Renderer interface for terminal output.

Note that it only supports a small subset of Markdown features. It should only be used for rendering documentation strings from Stripe's OpenAPI specification file.

Do not create this directly, instead use the MarkdownTermRenderer function.

func (options *MarkdownTerm) AutoLink(out *bytes.Buffer, link []byte, kind int)

func (*MarkdownTerm) BlockCode added in v0.5.2

func (options *MarkdownTerm) BlockCode(out *bytes.Buffer, text []byte, info string)

func (*MarkdownTerm) BlockHtml added in v0.5.2

func (options *MarkdownTerm) BlockHtml(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) BlockQuote added in v0.5.2

func (options *MarkdownTerm) BlockQuote(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) CodeSpan added in v0.5.2

func (options *MarkdownTerm) CodeSpan(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) DocumentFooter added in v0.5.2

func (options *MarkdownTerm) DocumentFooter(out *bytes.Buffer)

func (*MarkdownTerm) DocumentHeader added in v0.5.2

func (options *MarkdownTerm) DocumentHeader(out *bytes.Buffer)

func (*MarkdownTerm) DoubleEmphasis added in v0.5.2

func (options *MarkdownTerm) DoubleEmphasis(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) Emphasis added in v0.5.2

func (options *MarkdownTerm) Emphasis(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) Entity added in v0.5.2

func (options *MarkdownTerm) Entity(out *bytes.Buffer, entity []byte)

func (*MarkdownTerm) FootnoteItem added in v0.5.2

func (options *MarkdownTerm) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int)

func (*MarkdownTerm) FootnoteRef added in v0.5.2

func (options *MarkdownTerm) FootnoteRef(out *bytes.Buffer, ref []byte, id int)

func (*MarkdownTerm) Footnotes added in v0.5.2

func (options *MarkdownTerm) Footnotes(out *bytes.Buffer, text func() bool)

func (*MarkdownTerm) GetFlags added in v0.5.2

func (options *MarkdownTerm) GetFlags() int

func (*MarkdownTerm) HRule added in v0.5.2

func (options *MarkdownTerm) HRule(out *bytes.Buffer)

func (*MarkdownTerm) Header added in v0.5.2

func (options *MarkdownTerm) Header(out *bytes.Buffer, text func() bool, level int, id string)

func (*MarkdownTerm) Image added in v0.5.2

func (options *MarkdownTerm) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte)

func (*MarkdownTerm) LineBreak added in v0.5.2

func (options *MarkdownTerm) LineBreak(out *bytes.Buffer)
func (options *MarkdownTerm) Link(out *bytes.Buffer, link []byte, title []byte, content []byte)

func (*MarkdownTerm) List added in v0.5.2

func (options *MarkdownTerm) List(out *bytes.Buffer, text func() bool, flags int)

func (*MarkdownTerm) ListItem added in v0.5.2

func (options *MarkdownTerm) ListItem(out *bytes.Buffer, text []byte, flags int)

func (*MarkdownTerm) NormalText added in v0.5.2

func (options *MarkdownTerm) NormalText(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) Paragraph added in v0.5.2

func (options *MarkdownTerm) Paragraph(out *bytes.Buffer, text func() bool)

func (*MarkdownTerm) RawHtmlTag added in v0.5.2

func (options *MarkdownTerm) RawHtmlTag(out *bytes.Buffer, tag []byte)

func (*MarkdownTerm) StrikeThrough added in v0.5.2

func (options *MarkdownTerm) StrikeThrough(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) Table added in v0.5.2

func (options *MarkdownTerm) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int)

func (*MarkdownTerm) TableCell added in v0.5.2

func (options *MarkdownTerm) TableCell(out *bytes.Buffer, text []byte, align int)

func (*MarkdownTerm) TableHeaderCell added in v0.5.2

func (options *MarkdownTerm) TableHeaderCell(out *bytes.Buffer, text []byte, align int)

func (*MarkdownTerm) TableRow added in v0.5.2

func (options *MarkdownTerm) TableRow(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) TitleBlock added in v0.5.2

func (options *MarkdownTerm) TitleBlock(out *bytes.Buffer, text []byte)

func (*MarkdownTerm) TripleEmphasis added in v0.5.2

func (options *MarkdownTerm) TripleEmphasis(out *bytes.Buffer, text []byte)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳