[PR #39] [MERGED] Bugfix/cell after colspan #776

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/39
Author: @christophano
Created: 7/16/2016
Status: Merged
Merged: 7/19/2016
Merged by: @xoofx

Base: masterHead: bugfix/cell-after-colspan


📝 Commits (3)

  • ba8557d Corrects spec for TestExtensionsGridTable Example003
  • 6d8f899 Fixes cell contents not displaying after colspan merged cell
  • 264516b Updated tests via md file and regenerated from t4

📊 Changes

5 files changed (+27 additions, -18 deletions)

View changed files

📝 src/Markdig.Tests/Specs/GridTableSpecs.md (+5 -5)
📝 src/Markdig.Tests/Specs/Specs.cs (+6 -6)
📝 src/Markdig/Extensions/Tables/GridTableParser.cs (+7 -4)
📝 src/Markdig/Extensions/Tables/HtmlTableRenderer.cs (+3 -3)
📝 src/Markdig/Extensions/Tables/TableCell.cs (+6 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/xoofx/markdig/pull/39 **Author:** [@christophano](https://github.com/christophano) **Created:** 7/16/2016 **Status:** ✅ Merged **Merged:** 7/19/2016 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `bugfix/cell-after-colspan` --- ### 📝 Commits (3) - [`ba8557d`](https://github.com/xoofx/markdig/commit/ba8557d3bfb72467f546f6fdb7de6598be9b383d) Corrects spec for TestExtensionsGridTable Example003 - [`6d8f899`](https://github.com/xoofx/markdig/commit/6d8f8996d533d5215a5dc85ec3260da1bf6cee7e) Fixes cell contents not displaying after colspan merged cell - [`264516b`](https://github.com/xoofx/markdig/commit/264516bfdbb09c83c1856589a72ff663d78d3791) Updated tests via md file and regenerated from t4 ### 📊 Changes **5 files changed** (+27 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig.Tests/Specs/GridTableSpecs.md` (+5 -5) 📝 `src/Markdig.Tests/Specs/Specs.cs` (+6 -6) 📝 `src/Markdig/Extensions/Tables/GridTableParser.cs` (+7 -4) 📝 `src/Markdig/Extensions/Tables/HtmlTableRenderer.cs` (+3 -3) 📝 `src/Markdig/Extensions/Tables/TableCell.cs` (+6 -0) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 14:45:23 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#776