Skip to content

Infer pipe table column widths from separator row #863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025
Merged

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