[PR #455] Pipe Tables: Normalize using header column count #1045

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

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

State: closed
Merged: Yes


This is a potential fix for #454.

In this PR I'm introducing PipeTableOptions.UseHeaderForColumnCount, an option that allows switching the PipeTables extension's normalization behavior. It's defaulting to the current behavior (find the row with the most columns and make sure all other rows have the same amount of cells). When setting this option to true, the normalization will follow the example in GitHub's spec and remove/add cells in all rows until they match the number of cells in the header row.

I'm adding this as a draft PR for now since I need some guidance around the test suite:

Right now, I've changed the markdown example specs to conform to the new behavior and made the new behavior the default. Ideally, we'd have tests for both, the current and the new behavior - I just don't know how to do this. Does the markdown spec notation allow us to specify certain options to be used for the MarkdownPipeline?

**Original Pull Request:** https://github.com/xoofx/markdig/pull/455 **State:** closed **Merged:** Yes --- This is a potential fix for #454. In this PR I'm introducing `PipeTableOptions.UseHeaderForColumnCount`, an option that allows switching the PipeTables extension's normalization behavior. It's defaulting to the current behavior (find the row with the most columns and make sure all other rows have the same amount of cells). When setting this option to `true`, the normalization will follow the [example in GitHub's spec](https://github.github.com/gfm/#example-202) and remove/add cells in all rows until they match the number of cells in the header row. I'm adding this as a draft PR for now since I need some guidance around the test suite: Right now, I've changed the markdown example specs to conform to the new behavior and made the new behavior the default. Ideally, we'd have tests for both, the current and the new behavior - I just don't know how to do this. Does the markdown spec notation allow us to specify certain options to be used for the `MarkdownPipeline`?
claunia added the pull-request label 2026-01-29 14:49:00 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1045