Documentation
¶
Index ¶
- type Blueprint
- func (f *Blueprint) Close() error
- func (f *Blueprint) Config() tw.Rendition
- func (f *Blueprint) Footer(footers [][]string, ctx tw.Formatting)
- func (f *Blueprint) Header(headers [][]string, ctx tw.Formatting)
- func (f *Blueprint) Line(ctx tw.Formatting)
- func (f *Blueprint) Logger(logger *ll.Logger)
- func (f *Blueprint) Rendition(config tw.Rendition)
- func (f *Blueprint) Row(row []string, ctx tw.Formatting)
- func (f *Blueprint) Start(w io.Writer) error
- type Colorized
- func (c *Colorized) Close() error
- func (c *Colorized) Config() tw.Rendition
- func (c *Colorized) Debug() []string
- func (c *Colorized) Footer(footers [][]string, ctx tw.Formatting)
- func (c *Colorized) Header(headers [][]string, ctx tw.Formatting)
- func (c *Colorized) Line(ctx tw.Formatting)
- func (c *Colorized) Logger(logger *ll.Logger)
- func (c *Colorized) Rendition(newRendition tw.Rendition)
- func (c *Colorized) Reset()
- func (c *Colorized) Row(row []string, ctx tw.Formatting)
- func (c *Colorized) Start(w io.Writer) error
- type ColorizedConfig
- type Colors
- type HTML
- func (h *HTML) Close() error
- func (h *HTML) Config() tw.Rendition
- func (h *HTML) Debug() []string
- func (h *HTML) Footer(footers [][]string, ctx tw.Formatting)
- func (h *HTML) Header(headers [][]string, ctx tw.Formatting)
- func (h *HTML) Line(ctx tw.Formatting)
- func (h *HTML) Logger(logger *ll.Logger)
- func (h *HTML) Reset()
- func (h *HTML) Row(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() error
- func (m *Markdown) Config() tw.Rendition
- func (m *Markdown) Footer(footers [][]string, ctx tw.Formatting)
- func (m *Markdown) Header(headers [][]string, ctx tw.Formatting)
- func (m *Markdown) Line(ctx tw.Formatting)
- func (m *Markdown) Logger(logger *ll.Logger)
- func (m *Markdown) Reset()
- func (m *Markdown) Row(row []string, ctx tw.Formatting)
- func (m *Markdown) Start(w io.Writer) error
- type Ocean
- func (o *Ocean) Close() error
- func (o *Ocean) Config() tw.Rendition
- func (o *Ocean) Footer(footers [][]string, ctx tw.Formatting)
- func (o *Ocean) Header(headers [][]string, ctx tw.Formatting)
- func (o *Ocean) Line(ctx tw.Formatting)
- func (o *Ocean) Logger(logger *ll.Logger)
- func (o *Ocean) Rendition(config tw.Rendition)
- func (o *Ocean) Row(row []string, ctx tw.Formatting)
- func (o *Ocean) Start(w io.Writer) error
- type OceanConfig
- type SVG
- func (s *SVG) Close() error
- func (s *SVG) Config() tw.Rendition
- func (s *SVG) Debug() []string
- func (s *SVG) Footer(footers [][]string, ctx tw.Formatting)
- func (s *SVG) Header(headers [][]string, ctx tw.Formatting)
- func (s *SVG) Line(ctx tw.Formatting)
- func (s *SVG) Logger(logger *ll.Logger)
- func (s *SVG) Reset()
- func (s *SVG) Row(rowLine []string, ctx tw.Formatting)
- func (s *SVG) Start(w io.Writer) error
- type SVGConfig
- 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 primary table rendering engine with customizable borders and alignments.
func NewBlueprint ¶
NewBlueprint creates a new Blueprint instance with optional custom configurations.
func (*Blueprint) Footer ¶
func (f *Blueprint) Footer(footers [][]string, ctx tw.Formatting)
Footer renders the table footer section with configured formatting.
func (*Blueprint) Header ¶
func (f *Blueprint) Header(headers [][]string, ctx tw.Formatting)
Header renders the table header section with configured formatting.
func (*Blueprint) Line ¶
func (f *Blueprint) Line(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) Footer ¶
func (c *Colorized) Footer(footers [][]string, ctx tw.Formatting)
Footer renders the table footer with configured colors and formatting.
func (*Colorized) Header ¶
func (c *Colorized) Header(headers [][]string, ctx tw.Formatting)
Header renders the table header with configured colors and formatting.
func (*Colorized) Line ¶
func (c *Colorized) Line(ctx tw.Formatting)
Line renders a horizontal row line with colored junctions and segments, skipping zero-width columns.
func (*Colorized) Rendition ¶ added in v1.0.5
Rendition updates the parts of ColorizedConfig that correspond to tw.Rendition by merging the provided newRendition. Color-specific Tints are not modified.
func (*Colorized) Reset ¶
func (c *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)
}
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(configs ...HTMLConfig) *HTML
NewHTML initializes an HTML renderer with the given w, debug setting, and optional configuration. It panics if the w is nil and applies defaults for unset config fields. Update: see https://github.com/olekukonko/tablewriter/issues/258
func (*HTML) Close ¶
Close ensures all open HTML tags (<table>, <tbody>, <tfoot>) are properly closed.
func (*HTML) Footer ¶
func (h *HTML) Footer(footers [][]string, ctx tw.Formatting)
Footer renders the <tfoot> section with footer rows, supporting horizontal merges.
func (*HTML) Header ¶
func (h *HTML) Header(headers [][]string, ctx tw.Formatting)
Header renders the <thead> section with header rows, supporting horizontal merges.
func (*HTML) Line ¶
func (h *HTML) Line(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 ¶
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) Footer ¶
func (m *Markdown) Footer(footers [][]string, ctx tw.Formatting)
Footer renders the Markdown table footer.
func (*Markdown) Header ¶
func (m *Markdown) Header(headers [][]string, ctx tw.Formatting)
Header renders the Markdown table header and its separator line.
func (*Markdown) Line ¶
func (m *Markdown) Line(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.
type Ocean ¶ added in v1.0.1
type Ocean struct {
// contains filtered or unexported fields
}
Ocean is a streaming table renderer that writes ASCII tables.
func NewOcean ¶ added in v1.0.1
func NewOcean(oceanConfig ...OceanConfig) *Ocean
func (*Ocean) Footer ¶ added in v1.0.1
func (o *Ocean) Footer(footers [][]string, ctx tw.Formatting)
func (*Ocean) Header ¶ added in v1.0.1
func (o *Ocean) Header(headers [][]string, ctx tw.Formatting)
func (*Ocean) Line ¶ added in v1.0.1
func (o *Ocean) Line(ctx tw.Formatting)
type OceanConfig ¶ added in v1.0.1
type OceanConfig struct{}
OceanConfig defines configuration specific to the Ocean renderer.
type SVG ¶ added in v1.0.1
type SVG struct {
// contains filtered or unexported fields
}
SVG implements tw.Renderer for SVG output. Manages SVG element generation and merge tracking.
func NewSVG ¶ added in v1.0.1
NewSVG creates a new SVG renderer with configuration. Parameter configs provides optional SVGConfig; defaults used if empty. Returns a configured SVG instance.
func (*SVG) Close ¶ added in v1.0.1
Close finalizes SVG rendering and writes output. Parameter w is the output w. Returns an error if writing fails.
func (*SVG) Config ¶ added in v1.0.1
Config returns the renderer's configuration. No parameters are required. Returns a Rendition with border and debug settings.
func (*SVG) Debug ¶ added in v1.0.1
Debug returns the renderer's debug trace. No parameters are required. Returns a slice of debug messages.
func (*SVG) Footer ¶ added in v1.0.1
func (s *SVG) Footer(footers [][]string, ctx tw.Formatting)
Footer buffers footer lines for SVG rendering. Parameters include w (w), footers (lines), and ctx (formatting). No return value; stores data for later rendering.
func (*SVG) Header ¶ added in v1.0.1
func (s *SVG) Header(headers [][]string, ctx tw.Formatting)
Header buffers header lines for SVG rendering. Parameters include w (w), headers (lines), and ctx (formatting). No return value; stores data for later rendering.
func (*SVG) Line ¶ added in v1.0.1
func (s *SVG) Line(ctx tw.Formatting)
Line handles border rendering (ignored in SVG renderer). Parameters include w (w) and ctx (formatting). No return value; SVG borders are drawn in Close.
func (*SVG) Reset ¶ added in v1.0.1
func (s *SVG) Reset()
Reset clears the renderer's internal state. No parameters are required. No return value; prepares for new rendering.
type SVGConfig ¶ added in v1.0.1
type SVGConfig struct {
FontFamily string // e.g., "Arial, sans-serif"
FontSize float64 // Base font size in SVG units
LineHeightFactor float64 // Factor for line height (e.g., 1.2)
Padding float64 // Padding inside cells
StrokeWidth float64 // Line width for borders
StrokeColor string // Color for strokes (e.g., "black")
HeaderBG string // Background color for header
RowBG string // Background color for rows
RowAltBG string // Alternating row background color
HeaderColor string // Text color for header
RowColor string // Text color for rows
ApproxCharWidthFactor float64 // Char width relative to FontSize
MinColWidth float64 // Minimum column width
RenderTWConfigOverrides bool // Override SVG alignments with tablewriter
Debug bool // Enable debug logging
ScaleFactor float64 // Scaling factor for SVG
}
SVGConfig holds configuration for the SVG renderer. Fields include font, colors, padding, and merge rendering options. Used to customize SVG output appearance and behavior.