# `Kotoba.Nodes.TableCell`
[🔗](https://github.com/hattoriai/kotoba/blob/v0.5.0/lib/kotoba/nodes/table_cell.ex#L1)

A cell of a table (Lexical type `"tablecell"`).

`header_state` (`"headerState"`) is a set of bits: `0` for a data cell,
`1` for a cell of the header row, `2` for a cell of the header column,
and `3` for both. A header cell renders as `th`, with `scope="col"` in
the header row and `scope="row"` in the header column; a data cell
renders as `td`. `col_span` and `row_span` (`"colSpan"` and `"rowSpan"`)
are at least 1, and at most 1000. The editor's `backgroundColor`,
`width` and `verticalAlign` keys stay in `extra`, and the renderers do
not use them.

A cell is valid only in a `Kotoba.Nodes.TableRow`. It holds blocks
(paragraphs, headings, quotes, lists, code blocks, horizontal rules and
attachments) and inline nodes, but no table.

In plain text, the cells of a row are separated by a tab, and a cell
keeps its text as it is (a cell with two blocks has two lines). In
Markdown, a cell is one line: its line breaks become `<br>`, a tab
becomes a space, and `|` is escaped.

# `t`

```elixir
@type t() :: %Kotoba.Nodes.TableCell{
  children: term(),
  col_span: term(),
  direction: term(),
  extra: term(),
  format: term(),
  header_state: term(),
  indent: term(),
  row_span: term(),
  version: term()
}
```

# `align`

```elixir
@spec align(t()) :: String.t() | nil
```

Returns the alignment of the cell, `"left"`, `"center"` or `"right"`, or
`nil`: the alignment (`format`) of its first paragraph, as the editor
sets it. `"start"` and `"end"` are `"left"` and `"right"`.

# `column_header?`

```elixir
@spec column_header?(t()) :: boolean()
```

Returns `true` for a cell of the header row (`headerState` 1 or 3).

# `row_header?`

```elixir
@spec row_header?(t()) :: boolean()
```

Returns `true` for a cell of the header column (`headerState` 2 or 3).

---

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