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

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

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/863
Author: @Amberg
Created: 4/9/2025
Status: Merged
Merged: 4/15/2025
Merged by: @xoofx

Base: masterHead: master


📝 Commits (1)

  • 55f770c feat: infer pipe table column widths from separator row

📊 Changes

5 files changed (+88 additions, -19 deletions)

View changed files

📝 src/Markdig.Tests/TestPipeTable.cs (+38 -1)
📝 src/Markdig/Extensions/Tables/GridTableParser.cs (+1 -1)
📝 src/Markdig/Extensions/Tables/PipeTableOptions.cs (+7 -0)
📝 src/Markdig/Extensions/Tables/PipeTableParser.cs (+34 -11)
📝 src/Markdig/Extensions/Tables/TableHelper.cs (+8 -6)

📄 Description

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!


🔄 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/863 **Author:** [@Amberg](https://github.com/Amberg) **Created:** 4/9/2025 **Status:** ✅ Merged **Merged:** 4/15/2025 **Merged by:** [@xoofx](https://github.com/xoofx) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`55f770c`](https://github.com/xoofx/markdig/commit/55f770cc0724aff99b1de593ad4fba080645b500) feat: infer pipe table column widths from separator row ### 📊 Changes **5 files changed** (+88 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig.Tests/TestPipeTable.cs` (+38 -1) 📝 `src/Markdig/Extensions/Tables/GridTableParser.cs` (+1 -1) 📝 `src/Markdig/Extensions/Tables/PipeTableOptions.cs` (+7 -0) 📝 `src/Markdig/Extensions/Tables/PipeTableParser.cs` (+34 -11) 📝 `src/Markdig/Extensions/Tables/TableHelper.cs` (+8 -6) </details> ### 📄 Description 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! --- <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:52:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1257