diff --git a/scripts/generate.py b/scripts/generate.py index 22651ae..96c19d9 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -276,6 +276,21 @@ def render_list_group(element, acc): render_tree(element.children, acc) acc.append("") +def render_table(element, acc): + acc.append("") + render_tree(element.children, acc) + acc.append("
") + +def render_table_row(element, acc): + acc.append("") + for cell in element.cells: + acc.append("") + acc.append(html.escape(cell)) + acc.append("") + acc.append("") + +def render_table_separator_row(element, acc): + acc.append("") def render_list_item(element, acc): acc.append("
  • ") @@ -353,6 +368,9 @@ def render_tag(element, acc): dom.PropertyNode: render_property_node, dom.ListGroupNode: render_list_group, dom.ListItem: render_list_item, + dom.TableNode: render_table, + dom.TableSeparatorRow: render_table_separator_row, + dom.TableRow: render_table_row, dom.CodeBlock: render_code_block, dom.Text: render_text, dom.ResultsDrawerNode: render_results_block, diff --git a/static/style.css b/static/style.css index 9b37fde..f0c167d 100644 --- a/static/style.css +++ b/static/style.css @@ -189,6 +189,17 @@ article.post { border-bottom: #000 1px dashed; } +/* Tables. */ +table, th, td, tr { + border: 1px solid black; + border-collapse: collapse; +} +td { + padding: 0.5ex; +} +tr.__table-separator { + border-bottom: 0.5ex solid black; +} /* Dark mode. */ @media (prefers-color-scheme: dark) { @@ -236,4 +247,12 @@ article.post { color: #FFF; font-family: Menlo, Monaco, "Courier New", monospace; } + + /* Tables. */ + table, th, td, tr { + border: 1px solid #eee; + } + tr.__table-separator { + border-bottom: 0.5ex solid #eee; + } }