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
| Name | Type | Required | |
|---|---|---|---|
n_rows | int | Number of rows in the table. The first row is the table head. | |
n_cols | int | Number of columns in the table. | |
cells | dict[tuple[int, int], str] | The cell data in the {(index_row, index_col): text} format. | |
col_styles | dict[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
| Name | Type | |
|---|---|---|
v_1 | str | The 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
| Name | Type | Required | |
|---|---|---|---|
md | MarkdownIt | The markdown-it renderer. | |
text | str | The cell text. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The rendered cell text. |