Skip to main content

Table

ClassDataClassSource

Table(
n_rows: int,
n_cols: int,
cells: dict[tuple[int, int], str] = dict(...),
col_styles: dict[int, Literal["l", "c", "r", "n"]] = dict(...)
)

The Markdown table used to displaying arguments.

Fields

NameTypeRequired
Description
n_rowsintNumber of rows in the table. The first row is the table head.
n_colsintNumber of columns in the table.
cellsdict[tuple[int, int], str]The cell data in the {(index_row, index_col): text} format.
col_stylesdict[int, Literal["l", "c", "r", "n"]]The style of each column. The codes are: (l) left, (c): center, (r): right, (n): not specified.

Methods

as_md_text

v_1: str = self.as_md_text()

Render as Markdown text.

Returns

NameType
Description
v_1strThe Markdown text rendered from the table.

render_cell

v_1: str = self.render_cell(md: MarkdownIt, text: str)

Safely render the cell text.

If the text is a single pargraph, render it as it is. Otherwise, render it as HTML codes.

Requires

NameTypeRequired
Description
mdMarkdownItThe markdown-it renderer.
textstrThe cell text.

Returns

NameType
Description
v_1strThe rendered cell text.