Skip to content

Instantly share code, notes, and snippets.

@MidLifeXis
Last active January 31, 2017 19:50
Show Gist options
  • Select an option

  • Save MidLifeXis/435dfb2ae008c5fe73766c37884cacc6 to your computer and use it in GitHub Desktop.

Select an option

Save MidLifeXis/435dfb2ae008c5fe73766c37884cacc6 to your computer and use it in GitHub Desktop.
Example of table MD

This example data causes the frobnitz process to break:

ID Field 1 Field 2 expected received
id_1 data 1 1 data 1 2 Foo Bar

And an implementation of an output formatter based on Text::Table.

use strict;
use warnings;

use Text::Table;

# Note that for GHFM, tables need a minimum of three characters somewhere in the column
my @headers = ("ID ", "FOO", "BAR" );
my @data    = ( [1..3], [4..6], [7..9] );

my $formatter = Text::Table->new( \"|", map { ( $_, \"|" ) } @headers );
$formatter->load( @data );
print $formatter->title, $formatter->rule( "-", "|" ), $formatter->body;
ID FOO BAR
1 2 3
4 5 6
7 8 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment