Skip to content

Tables: add table directive with column width control#2852

Open
reakaleek wants to merge 5 commits intomainfrom
feature/table-directive-column-widths
Open

Tables: add table directive with column width control#2852
reakaleek wants to merge 5 commits intomainfrom
feature/table-directive-column-widths

Conversation

@reakaleek
Copy link
Member

@reakaleek reakaleek commented Mar 4, 2026

What

  • Add {table} directive that wraps pipe tables and controls column widths via a 12-unit grid (similar to Bootstrap)
  • Support presets: auto (default, browser determines widths from content), description (4-8 for term/description)
  • Support custom widths: dash-separated values that sum to 12 (e.g. 4-8, 2-4-6, 4-4-4)
  • Inject <colgroup> and table-layout:fixed when widths are specified so browsers respect column proportions

Why

  • Authors need to control table column widths for definition lists, API parameter tables, and asymmetric layouts
  • Without explicit widths, the browser sizes columns from content, which often looks wrong for narrow keys vs wide descriptions

Notes

  • Column count validation runs at render time, not during block close, because Markdig converts pipe tables from paragraphs to table blocks during inline parsing (after the directive block is closed)
  • Uses invariant culture for decimal formatting in colgroup so widths render consistently across locales

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🔍 Preview links for changed docs

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant