Render note tables.
This commit is contained in:
parent
f6254a6c53
commit
cc8d7d0bc5
@ -276,6 +276,21 @@ def render_list_group(element, acc):
|
||||
render_tree(element.children, acc)
|
||||
acc.append("</ul>")
|
||||
|
||||
def render_table(element, acc):
|
||||
acc.append("<table>")
|
||||
render_tree(element.children, acc)
|
||||
acc.append("</table>")
|
||||
|
||||
def render_table_row(element, acc):
|
||||
acc.append("<tr>")
|
||||
for cell in element.cells:
|
||||
acc.append("<td>")
|
||||
acc.append(html.escape(cell))
|
||||
acc.append("</td>")
|
||||
acc.append("</tr>")
|
||||
|
||||
def render_table_separator_row(element, acc):
|
||||
acc.append("<tr class='__table-separator'></tr>")
|
||||
|
||||
def render_list_item(element, acc):
|
||||
acc.append("<li>")
|
||||
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user