spruce/table
Bordered, ANSI-aware data table rendering.
Types
Values
pub fn border(table: Table, border: box.Border) -> Table
Set the table border style.
Junctions are exact for Normal, Rounded, Thick, and Double. Other border styles approximate junctions from their edge characters.
pub fn column_widths(table: Table, widths: List(Int)) -> Table
Constrain columns to maximum visual widths.
Widths less than one are ignored. Columns without a corresponding configured width use their natural content width.
pub fn render(sp: spruce.Spruce, table: Table) -> String
Render a table as a bordered grid.
pub fn row_separators(table: Table, enabled: Bool) -> Table
Toggle separator lines between body rows.
pub fn rows(table: Table, rows: List(List(String))) -> Table
Set the body rows. Short rows are padded with empty cells at render time.
pub fn style_fn(
table: Table,
style_fn: fn(Int, Int) -> style.Style,
) -> Table
Set a per-cell style function.
Body rows are passed zero-based row indexes. Header cells are passed row -1.