[PR #39] Bugfix/cell after colspan #781

Open
opened 2026-01-29 14:45:26 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/xoofx/markdig/pull/39

State: closed
Merged: Yes


Example 003 for Grid Tables has a small error in the expected output.
Input:

+---------+---------+---------+
| Col1    | Col2    | Col3    |
| Col1a   | Col2a   | Col3a   |
| Col1b             | Col3b   |
| Col1c                       |

Should produce:

Col1
Col1a
Col2
Col2a
Col3
Col3a
Col1b Col3b
Col1c

But the spec expects (and currently passes):

Col1
Col1a
Col2
Col2a
Col3
Col3a
Col1b
Col1c

This hides a small bug when cells follow cells with with a colspan.
I've adjusted the way column span is calculated to correct this.
I've also added a property to TableCell called ColumnIndex which records which column a cell belongs to, to make sure alignment is correctly inherited. This property is not used for pipe tables.

**Original Pull Request:** https://github.com/xoofx/markdig/pull/39 **State:** closed **Merged:** Yes --- Example 003 for Grid Tables has a small error in the expected output. Input: ``` +---------+---------+---------+ | Col1 | Col2 | Col3 | | Col1a | Col2a | Col3a | | Col1b | Col3b | | Col1c | ``` Should produce: <table> <col style="width:33.33%"> <col style="width:33.33%"> <col style="width:33.33%"> <tbody> <tr> <td>Col1<br /> Col1a</td> <td>Col2<br /> Col2a</td> <td>Col3<br /> Col3a</td> </tr> <tr> <td colspan="2">Col1b</td> <td>Col3b</td> </tr> <tr> <td colspan="3">Col1c</td> </tr> </tbody> </table> But the spec expects (and currently passes): <table> <col style="width:33.33%"> <col style="width:33.33%"> <col style="width:33.33%"> <tbody> <tr> <td>Col1<br /> Col1a</td> <td>Col2<br /> Col2a</td> <td>Col3<br /> Col3a</td> </tr> <tr> <td colspan="2">Col1b</td> <td></td> </tr> <tr> <td colspan="3">Col1c</td> </tr> </tbody> </table> This hides a small bug when cells follow cells with with a colspan. I've adjusted the way column span is calculated to correct this. I've also added a property to `TableCell` called `ColumnIndex` which records which column a cell belongs to, to make sure alignment is correctly inherited. This property is not used for pipe tables.
claunia added the pull-request label 2026-01-29 14:45:26 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#781