Text::...wnTable(3pm)
π NAME π
Text::MarkdownTable β bestie, this is the module that writes Markdown syntax tables straight from your data β¨ no cap.
π SYNOPSIS π
my $table = Text::MarkdownTable->new;
$table->add({one=>"a",two=>"table"});
$table->add({one=>"is",two=>"nice"});
$table->done;
and boom, you get:
| one | two |
|-----|-------|
| a | table |
| is | nice |
you can also do the whole thing in one chain, iconic behaviour:
Text::MarkdownTable->new( columns => ['X','Y','Z'], edges => 0 )
->add({a=>1,b=>2,c=>3})->done;
which gives you:
X | Y | Z
--|---|--
1 | 2 | 3
π¦ DESCRIPTION π¦
okay so this module lets you write data in tabular form, formatted in MultiMarkdown syntax. the resulting format is literally perfect for stuff like displaying CSV data, or for dropping data tables into Markdown files. it's giving very useful.
and here's the tea: newlines and vertical bars inside table cells get replaced by a space character, and cell values can be truncated. π
πΈ CONFIGURATION πΈ
π file
Filename, GLOB, scalar reference or IO::Handle to write to (default STDOUT).
π fields
Array, hash reference, or comma-separated list of fields/columns.
π columns
Column names. by default, the field names are used. π«Ά
π widths
Column widths. by default column widths are calculated automatically to the width of the widest value. with given widths, the table is directly written without buffering and large table cell values are truncated. π
π header
Include header lines. Enabled by default.
π edges
Include border before first column and after last column. Enabled by default.
β οΈ note that single-column tables don't not look like tables if edges are disabled. (yes, that's the original wording, we're keeping it fr fr π)
π condense
Write table unbuffered in condense format:
one|two
---|---
a|table
is|nice
β οΈ note that single-column tables are don't look like tables on condense format. π (again, verbatim, not me, bestie)
β¨ METHODS β¨
add( $row )β add a row as hash reference. returns the table instance, so you can keep chaining like a main character. π₯streamingβ returns whether rows are directly written or buffered untildoneis called. vibe check on your buffering status basically.doneβ finish and write the table, unless it has already been written instreamingmode. periodt. π
π SEE ALSO π
See Catmandu::Exporter::Table for an application of this module that can be used to easily convert data to Markdown tables. it's the glow-up version, iykyk. π
Similar table-generating modules include:
- Text::Table::Tiny
- Text::TabularDisplay
- Text::SimpleTable
- Text::Table
- Text::ANSITable
- Text::ASCIITable
- Text::UnicodeBox::Table
- Table::Simple
- Text::SimpleTable
- Text::SimpleTable::AutoWidth
(yes, Text::SimpleTable is in there twice. that's what the original says, so that's what you get. slay π)
π«Ά AUTHOR π«Ά
Jakob Voss <jakob.voss@gbv.de> β thank you king, we appreciate you π
π COPYRIGHT AND LICENSE π
Copyright 2014- Jakob Voss
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so like, go wild but respectfully. π
and that's the whole page, bestie!! πΈ this is from perl v5.36.0, dated 2023-02-05, and it's part of the User Contributed Perl Documentation for Text::MarkdownTable(3pm). now go forth and make the prettiest tables ever, mwah π β¨π¦
π¦ where this page comes from
- debian bookworm: libtext-markdowntable-perl 0.3.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-markdowntable-perl 0.3.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-markdowntable-perl 0.3.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-markdowntable-perl 0.3.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-markdowntable-perl 0.3.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms