Skip to content

Infer pipe table column widths from separator row#863

Merged
xoofx merged 1 commit intoxoofx:masterfrom
Amberg:master
Apr 15, 2025
Merged

Infer pipe table column widths from separator row#863
xoofx merged 1 commit intoxoofx:masterfrom
Amberg:master

Conversation

@Amberg
Copy link
Contributor

@Amberg Amberg commented Apr 9, 2025

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!

Adds support for calculating column widths in pipe tables based on the number of dashes in the header separator row.
Enabled via the InferColumnWidthsFromSeparator option in PipeTableOptions.
@Amberg Amberg changed the title Unfer pipe table column widths from separator row Infer pipe table column widths from separator row Apr 9, 2025
@xoofx xoofx merged commit 40e5ab1 into xoofx:master Apr 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants