Documentation
¶
Index ¶
- type Blueprint
- func (f *Blueprint) Close(w io.Writer) error
- func (f *Blueprint) Config() tw.RendererConfig
- func (f *Blueprint) Debug() []string
- func (f *Blueprint) Footer(w io.Writer, footers [][]string, ctx tw.Formatting)
- func (f *Blueprint) Header(w io.Writer, headers [][]string, ctx tw.Formatting)
- func (f *Blueprint) Line(w io.Writer, ctx tw.Formatting)
- func (f *Blueprint) Row(w io.Writer, row []string, ctx tw.Formatting)
- func (f *Blueprint) Start(w io.Writer) error
- type Colorized
- func (f *Colorized) Close(w io.Writer) error
- func (f *Colorized) Config() tw.RendererConfig
- func (f *Colorized) Debug() []string
- func (f *Colorized) Footer(w io.Writer, footers [][]string, ctx tw.Formatting)
- func (f *Colorized) Header(w io.Writer, headers [][]string, ctx tw.Formatting)
- func (f *Colorized) Line(w io.Writer, ctx tw.Formatting)
- func (f *Colorized) Reset()
- func (f *Colorized) Row(w io.Writer, row []string, ctx tw.Formatting)
- func (f *Colorized) Start(w io.Writer) error
- type ColorizedConfig
- type Colors
- type HTML
- func (h *HTML) Close(w io.Writer) error
- func (h *HTML) Config() tw.RendererConfig
- func (h *HTML) Debug() []string
- func (h *HTML) Footer(w io.Writer, footers [][]string, ctx tw.Formatting)
- func (h *HTML) Header(w io.Writer, headers [][]string, ctx tw.Formatting)
- func (h *HTML) Line(w io.Writer, ctx tw.Formatting)
- func (h *HTML) Reset()
- func (h *HTML) Row(w io.Writer, row []string, ctx tw.Formatting)
- func (h *HTML) Start(w io.Writer) error
- type HTMLConfig
- type Junction
- type JunctionContext
- type Markdown
- func (m *Markdown) Close(w io.Writer) error
- func (m *Markdown) Config() tw.RendererConfig
- func (m *Markdown) Debug() []string
- func (m *Markdown) Footer(w io.Writer, footers [][]string, ctx tw.Formatting)
- func (m *Markdown) Header(w io.Writer, headers [][]string, ctx tw.Formatting)
- func (m *Markdown) Line(w io.Writer, ctx tw.Formatting)
- func (m *Markdown) Reset()
- func (m *Markdown) Row(w io.Writer, row []string, ctx tw.Formatting)
- func (m *Markdown) Start(w io.Writer) error
- type Tint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blueprint ¶
type Blueprint struct {
// contains filtered or unexported fields
}
Blueprint implements a basic default table renderer with customizable borders and alignments.
func NewBlueprint ¶
func NewBlueprint(configs ...tw.RendererConfig) *Blueprint
func (*Blueprint) Config ¶
func (f *Blueprint) Config() tw.RendererConfig
Config returns the renderer's current configuration.
func (*Blueprint) Line ¶
func (f *Blueprint) Line(w io.Writer, ctx tw.Formatting)
Line renders a full horizontal row line with junctions and segments.
type Colorized ¶
type Colorized struct {
// contains filtered or unexported fields
}
Colorized renders colored ASCII tables with customizable borders, colors, and alignments.
func NewColorized ¶
func NewColorized(configs ...ColorizedConfig) *Colorized
NewColorized creates a Colorized renderer with the specified configuration, falling back to defaults if none provided. Only the first config is used if multiple are passed.
func (*Colorized) Config ¶
func (f *Colorized) Config() tw.RendererConfig
Config returns the renderer's configuration as a RendererConfig.
func (*Colorized) Line ¶
func (f *Colorized) Line(w io.Writer, ctx tw.Formatting)
Line renders a horizontal row line with colored junctions and segments, skipping zero-width columns.
func (*Colorized) Reset ¶
func (f *Colorized) Reset()
Reset clears the renderer's internal state, including debug traces.
type ColorizedConfig ¶
type ColorizedConfig struct {
Borders tw.Border // Border visibility settings
Settings tw.Settings // Rendering behavior settings (e.g., separators, whitespace)
Header Tint // Colors for header cells
Column Tint // Colors for row cells
Border Tint // Colors for borders and lines
Separator Tint // Colors for column separators
Symbols tw.Symbols // Symbols for table drawing (e.g., corners, lines)
Debug bool // Enables debug logging
}
ColorizedConfig holds configuration for the Colorized table renderer.
type Colors ¶
Colors is a slice of color attributes for use with fatih/color, such as color.FgWhite or color.Bold.
type HTML ¶
type HTML struct {
// contains filtered or unexported fields
}
HTML renders tables in HTML format with customizable classes and content handling.
func NewHTML ¶
func NewHTML(w io.Writer, debug bool, configs ...HTMLConfig) *HTML
NewHTML initializes an HTML renderer with the given writer, debug setting, and optional configuration. It panics if the writer is nil and applies defaults for unset config fields.
func (*HTML) Close ¶
Close ensures all open HTML tags (<table>, <tbody>, <tfoot>) are properly closed.
func (*HTML) Config ¶
func (h *HTML) Config() tw.RendererConfig
Config returns a RendererConfig representation of the current configuration.
func (*HTML) Footer ¶
Footer renders the <tfoot> section with footer rows, supporting horizontal merges.
func (*HTML) Header ¶
Header renders the <thead> section with header rows, supporting horizontal merges.
func (*HTML) Line ¶
func (h *HTML) Line(w io.Writer, ctx tw.Formatting)
Line is a no-op for HTML rendering, as structural lines are handled by tags.
func (*HTML) Reset ¶
func (h *HTML) Reset()
Reset clears the renderer's internal state, including debug traces and merge tracking.
type HTMLConfig ¶
type HTMLConfig struct {
EscapeContent bool // Whether to escape cell content
AddLinesTag bool // Whether to wrap multiline content in <lines> tags
TableClass string // CSS class for <table>
HeaderClass string // CSS class for <thead>
BodyClass string // CSS class for <tbody>
RowClass string // CSS class for <tr> in body
HeaderRowClass string // CSS class for <tr> in header
}
HTMLConfig defines settings for the HTML table renderer.
type Junction ¶
type Junction struct {
// contains filtered or unexported fields
}
Junction handles rendering of table junction points (corners, intersections) with color support.
func NewJunction ¶
func NewJunction(ctx JunctionContext) *Junction
NewJunction initializes a Junction with the given symbols, context, and tints. If debug is nil, a no-op debug function is used.
func (*Junction) GetSegment ¶
GetSegment determines whether to render a colored horizontal line or an empty space based on merge states.
func (*Junction) RenderJunction ¶
RenderJunction selects and colors the junction symbol between two adjacent columns based on merge states and table position.
func (*Junction) RenderLeft ¶
RenderLeft selects and colors the leftmost junction symbol for the current row line based on position and merges.
func (*Junction) RenderRight ¶
RenderRight selects and colors the rightmost junction symbol for the row line based on position, merges, and last column index.
type JunctionContext ¶
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
Markdown renders tables in Markdown format with customizable settings.
func NewMarkdown ¶
func NewMarkdown(configs ...tw.RendererConfig) *Markdown
NewMarkdown initializes a Markdown renderer with defaults tailored for Markdown (e.g., pipes, header separator). Only the first config is used if multiple are provided.
func (*Markdown) Config ¶
func (m *Markdown) Config() tw.RendererConfig
Config returns the renderer's current configuration.
func (*Markdown) Line ¶
func (m *Markdown) Line(w io.Writer, ctx tw.Formatting)
Line is a no-op for Markdown, as only the header separator is rendered (handled by Header).
func (*Markdown) Reset ¶
func (m *Markdown) Reset()
Reset clears the renderer's internal state, including debug traces.