# `WardrikDaemon.Console.Table`

A markdown table: its header, its body rows, and each column's alignment.

`WardrikDaemon.Console.Markdown` builds one from the rows it held back, and returns it in place
of a line. Whoever draws it lays it out at the width it has then. `lines/2` does that for a
terminal written a line at a time.

# `alignment`

```elixir
@type alignment() :: :left | :right | :center
```

How a column's cells are aligned, from the rule row's colons.

# `t`

```elixir
@type t() :: %WardrikDaemon.Console.Table{
  alignments: [alignment()],
  header: [Owl.Data.t()],
  indent: non_neg_integer(),
  rows: [[Owl.Data.t()]]
}
```

A header row, body rows, one alignment per column, and how many columns to indent.

# `alignment`

```elixir
@spec alignment(String.t()) :: alignment()
```

Returns the alignment a rule cell asks for: `:---:` is `:center`, `---:` is `:right`, anything else `:left`.

# `lines`

```elixir
@spec lines(t(), pos_integer()) :: [Owl.Data.t()]
```

Returns the table as lines no wider than `width`, for a terminal that's never redrawn.

The table is boxed, with a bright header. Columns take their natural width if they fit. If not,
each cell wraps inside its column, at the left. A table with no body rows is its header alone.

# `new`

```elixir
@spec new([Owl.Data.t()], [[Owl.Data.t()]], [alignment()]) :: t()
```

Returns a table from its header, body rows and alignments.

Short rows are padded with empty cells. Missing alignments are `:left`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
