[PR #863] Infer pipe table column widths from separator row #1262

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

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

State: closed
Merged: Yes


Hi

First off, thank you for your great library — I use it to convert Markdown to Open XML in my DocxTemplater, and it’s been working beautifully.

In my use case, I needed a way to control column widths in pipe tables. Unfortunately, the grid table syntax wasn't an option because it requires monospaced fonts.

This PR introduces a small but useful enhancement:

What’s included

  • Adds support for inferring column widths in pipe tables based on the number of dashes in the header separator row.
  • Activates this behavior via a new option: PipeTableOptions.InferColumnWidthsFromSeparator.
  • Includes unit tests to ensure the feature works with different table layouts and dash distributions.

This allows authors to write tables like:

A | B | C
--|----|--

…to get column widths of 25%, 50%, 25%, depending on the relative dash count.

Let me know if you'd like changes or further refinements — happy to adjust!

Thanks again for your work!

**Original Pull Request:** https://github.com/xoofx/markdig/pull/863 **State:** closed **Merged:** Yes --- Hi First off, thank you for your great library — I use it to convert Markdown to Open XML in my [DocxTemplater](https://github.com/Amberg/DocxTemplater), and it’s been working beautifully. In my use case, I needed a way to control column widths in pipe tables. Unfortunately, the grid table syntax wasn't an option because it requires monospaced fonts. This PR introduces a small but useful enhancement: ### What’s included - Adds support for inferring column widths in pipe tables based on the number of dashes in the header separator row. - Activates this behavior via a new option: `PipeTableOptions.InferColumnWidthsFromSeparator`. - Includes unit tests to ensure the feature works with different table layouts and dash distributions. This allows authors to write tables like: ```markdown A | B | C --|----|-- ``` …to get column widths of 25%, 50%, 25%, depending on the relative dash count. Let me know if you'd like changes or further refinements — happy to adjust! Thanks again for your work!
claunia added the pull-request label 2026-01-29 14:52:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1262