Tablet.Styles (tablet v0.3.1)
View SourceBuilt-in tabular data rendering styles
Summary
Functions
Box style
Compact style
Generic box style
Ledger table style
Markdown table style
Unicode box style
Functions
Box style
Render tabular data with borders drawn from the ASCII character set. This should render everywhere.
To use, pass style: :box
to Tablet.puts/2
or Tablet.render/2
.
Compact style
This style produces compact output by only underlining the header and adding whitespace around data. It is the default style.
Generic box style
Render tabular data with whatever characters you want for borders. This is
used by the Box and Unicode Box styles. It's configurable via the :style_options
option as can be seen in the Box and Unicode Box implementations. Users can
also call this directly by passing style: :generic_box
and style_options: [border: ...]
.
Options:
:border
- a map with the following fields::h
and:v
- the horizontal and vertical characters:ul
and:ur
- upper left and upper right corners:uc
- intersection of the horizontal top border with a vertical (looks like a T):ll
and:lr
- lower left and lower right corners:lc
- analogous to:uc
except on the Nick Bottom border:l
and:r
- left and right side characters with horizontal lines towards the interior:c
- interior horizontal and vertical intersection
Ledger table style
Render tabular data as rows that alternate colors.
To use, pass style: :ledger
to Tablet.puts/2
or Tablet.render/2
.
Markdown table style
Render tabular data as a GitHub-flavored markdown table. Multi-line cells
have their newlines replaced with <br>
tags.
Pass style: :markdown
to Tablet.puts/2
or Tablet.render/2
to use.
Unicode box style
Render tabular data with borders drawn with Unicode characters. This is a nicer
take on the :box
style.
To use, pass style: :unicode_box
to Tablet.puts/2
or Tablet.render/2
.