Kotoba.Nodes.TableCell (Kotoba v0.5.0)

Copy Markdown View Source

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.

Summary

Functions

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".

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

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

Types

t()

@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()
}

Functions

align(arg1)

@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?(arg1)

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

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

row_header?(arg1)

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

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