Documentation
¶
Overview ¶
Package termtable renders tabular data in five built-in styles: bordered (unicode box, default), rounded, ascii, markdown, and borderless padded columns for scripts. Rows normalize to the header width, empty tables render nothing, and unknown styles error.
The renderer is private under termtable/internal/table, written for this module: no third-party table code and no attribution duties surface in this API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Style ¶
type Style int
Style selects the table look. New styles arrive as new values; unknown values fail Render instead of silently picking one.
const ( // StyleBordered is a unicode box table with full borders. Default. StyleBordered Style = iota // StyleRounded is StyleBordered with rounded corners. StyleRounded // StyleASCII is StyleBordered with plain ascii glyphs. StyleASCII // StyleMarkdown renders a pipe table with a header rule, for docs. StyleMarkdown // StyleBorderless renders padded columns without borders for scripts. StyleBorderless )
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table buffers a header plus string rows and renders on demand.
func (*Table) Render ¶
Render draws the table with the selected style. Rows normalize to the header width (short rows pad empty, long rows truncate), matching script-friendly expectations on every style.
func (*Table) SetHeaders ¶
SetHeaders replaces the header row.