std.tbl.pipe_table

std.tbl

pipe_table(headers, t) -> lines

Generate a markdown pipe table from headers and data

Returns an array of strings (one per line) forming a markdown pipe table. headers is an array of header definitions (see parse_pipe_table_header). t is an array of rows, each row being an array of cell values. Column widths are computed by calc_table_maxes. Headers are center-aligned; data cells follow the alignment declared in each header definition.

Example:

local lines = pipe_table(
    { "Name", "Age:right", "City:center" },
    {
        { "Alice", 30, "New York" },
        { "Bob",   25, "Los Angeles" },
    }
)