Repository navigation
Preserve table column alignment across row spans - #316
Aschenbath wants to merge 1 commit into
Conversation
|
There is a span-normalization mismatch at from markdownify import markdownify
html = '''<table>
<tr><td rowspan="2" colspan="+2">one</td><td>two</td></tr>
<tr><td>three</td></tr>
</table>'''
print(markdownify(html, table_infer_header=True))Current output: | one | two |
| --- | --- |
| | | three |
The baseline already has incorrect rowspan alignment, but preserves all three cell texts in this example. Could the occupancy pass and the cell/header emitters use the same span normalization, with a regression covering a non-digit-only colspan? That would keep their column counts consistent. |
Cells following a rowspan currently shift into the wrong Markdown columns. Expand the occupied slots to empty cells before conversion, on a copy of the table so caller-owned soup remains reusable. Combined row/column spans, empty rows, nested tables and row-group boundaries are handled while preserving existing cell conversion hooks.
Fixes #121.
Validation: all 108 tests pass on Python 3.12; flake8 passes. Nine new regression cases fail on the unchanged baseline.