Documentation
¶
Overview ¶
Text rendering shared by every card, markdown, code, diffs, tables and small formatters tuned to the theme
Index ¶
- Constants
- func Bad(text string, t theme.Theme) string
- func Bar(fraction float64, width int, t theme.Theme) string
- func Bytes(n int64) string
- func Code(src, lang, path string, t theme.Theme) string
- func CodeStyle(t theme.Theme) string
- func Columns(cols []Column, rows [][]string, width int) (xs, widths []int)
- func Cool(text string, t theme.Theme) string
- func Count(n int, noun string) string
- func Dim(text string, t theme.Theme) string
- func Divider(width int, t theme.Theme) string
- func Elapsed(d time.Duration) string
- func FileLink(path string, line int, t theme.Theme) string
- func Fit(s string, width int, t theme.Theme) string
- func FormatDiff(lines []Line, width int, t theme.Theme) string
- func Gauge(fraction float64, width int, t theme.Theme) string
- func Good(text string, t theme.Theme) string
- func Heading(text string, t theme.Theme) string
- func Hot(text string, t theme.Theme) string
- func Hunks(lines []Line, context int) [][]Line
- func KV(key, value string, t theme.Theme) string
- func Language(path string) string
- func Lines(s string) []string
- func Link(text, url string, t theme.Theme) string
- func MarkdownText(src string, width int, t theme.Theme) string
- func Money(f float64) string
- func Paint(st lipgloss.Style, text string) string
- func Percent(f float64) string
- func Spinner(tick int, t theme.Theme) string
- func Stat(lines []Line) (added, removed int)
- func StyleConfig(t theme.Theme) ansi.StyleConfig
- func Summary(s string, width int, t theme.Theme) string
- func Table(cols []Column, rows [][]string, width int, selected int, t theme.Theme) string
- func TableEdit(cols []Column, rows [][]string, width int, selected int, edit *Edit, ...) string
- func TableMarked(cols []Column, rows [][]string, width int, selected int, marked func(int) bool, ...) string
- func Tail(s string, n int) string
- func Tokens(n int) string
- func ToolGlyph(name string, t theme.Theme) string
- func Truncate(s string, width int, t theme.Theme) string
- func Warm(text string, t theme.Theme) string
- func Wrap(s string, width int) string
- type Column
- type Edit
- type Line
- type Markdown
- type Op
Constants ¶
const MaxDiffLines = 6000
Lines beyond which a diff is summarized instead of computed
const TableHead = 2
Rows the table spends above its first row, the header and the rule under it
Variables ¶
This section is empty.
Functions ¶
func Divider ¶
Dashed rule of width with the theme info mark at its middle, dashes alone when too narrow for one
func FormatDiff ¶
Renders already computed diff lines
func Hunks ¶
Hunks of changed lines with the context around them, unchanged runs collapsed to a marker
func MarkdownText ¶
Renders markdown at width in the theme using the shared cache
func Paint ¶
Renders text in the style, restarting the style after every reset inside the text so its background runs unbroken
func StyleConfig ¶
func StyleConfig(t theme.Theme) ansi.StyleConfig
Glamour style derived from the theme, starting from the dark, light or ASCII set
func Table ¶
Renders rows under headers at width, cutting cells to their column and marking the selected row
func TableEdit ¶
func TableEdit(cols []Column, rows [][]string, width int, selected int, edit *Edit, t theme.Theme) string
Renders the table with one cell of the selected row shown as it is being typed into
func TableMarked ¶
func TableMarked(cols []Column, rows [][]string, width int, selected int, marked func(int) bool, edit *Edit, t theme.Theme) string
Renders the table with the cursor row lit and every other marked row tinted as part of the selection
Types ¶
type Column ¶
type Column struct {
Title string
// Share of spare width the column takes, zero fitting it to its content
Flex int
// Right aligns the cells, for numbers
Right bool
// Largest width the column grows to, unlimited when zero
Max int
}
Column of a table with how its cells align
type Edit ¶
Cell of the selected row being typed into in place, its text shown selected until the first keystroke
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
Markdown renderer cached per theme and width
func NewMarkdown ¶
func NewMarkdown() *Markdown