Tablet.Styles (tablet v0.1.0)

View Source

Built-in tabular data rendering styles

Summary

Functions

box(table, context, rows)

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(table, arg2, rows)

Compact style

This style produces compact output by only underlining the header and adding whitespace around data. It is the default style.

generic_box(table, map, rows)

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 :context option as can be seen in the Box and Unicode Box implementations. Users can also call this directly by passing style: :generic_box and context: ....

The :context map must contain a key called :border that is 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, arg2, rows)

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, arg2, row)

Markdown table style

Render tabular data as a GitHub-flavored markdown table.

Pass style: :markdown to Tablet.puts/2 or Tablet.render/2 to use.

unicode_box(table, context, rows)

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.