Darian Moody

TableRex

Text-based tables for Elixir

A terminal cycling through tables rendered by TableRex in different styles

TableRex is an Elixir library that generates text-based tables for display: in command-line apps, logs, or anywhere else plain text goes. A one-liner renders an ASCII-style table with sane defaults:

TableRex.quick_render!(rows, header, title)
|> IO.puts
+-----------------------------------------------------------+
|                   Drum & Bass Releases                    |
+----------------|---------------|-------------------|------+
| Artist         | Track         | Label             | Year |
+----------------|---------------|-------------------|------+
| Konflict       | Cyanide       | Renegade Hardware | 1999 |
| Marcus Intalex | Temperance    | Soul:r            | 2004 |
| Kryptic Minds  | The Forgotten | Defcom Records    | 2007 |
+----------------|---------------|-------------------|------+

Underneath, the table structures support column and cell alignment, titles and headers, sorting on the raw data, colour, padding, multi-line cells, and CJK and Unicode text. Framing and separators can be restyled, GitHub-flavoured Markdown included, and rendering is pluggable for formats the built-in renderer doesn't cover.

It's on Hex with docs on HexDocs, and is listed in Awesome Elixir.