Hello,
I will suggest to @piotrmurach to add a method to tty-table to generate markdown. It can ba called .to_md
It is similar to the actual
table.render(:ascii, alignments: [:center, :right])
# =>
# +-------+-------+
# |header1|header2|
# +-------+-------+
# | a1 | a2|
# | b1 | b2|
# +-------+-------+
.to_md should remove first and last lines and adapt the line under the headers.
table.to_md(alignments: [:center, :right])
# =>
# |header1|header2|
# |:-----:|------:|
# | a1 | a2|
# | b1 | b2|
It is important to align text also in markdown, because it is more readable than:
# |header1|header2|
# |:-----:|------:|
# |a1|a2|
# |b1|b2|
Thank you,
Joan Ramió.
Top comments (0)