Skip to content

Add pad_table_cells option - #169

Merged
letmutex merged 1 commit into
letmutex:mainfrom
FalkWoldmann:table-cell-padding
Nov 25, 2026
Merged

letmutex merged 1 commit into
letmutex:mainfrom
FalkWoldmann:table-cell-padding

Conversation

@FalkWoldmann

@FalkWoldmann FalkWoldmann commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Padding every cell to its column's width makes a table a lot bigger when one cell is long, which is wasted when the markdown goes to an LLM and nobody reads the source. This adds pad_table_cells (default true) to turn it off.

Since Options has only public fields, this breaks struct literals without ..Default::default(), so it probably needs a 0.7. Would you take it like this, or would you prefer an enum?

Summary by CodeRabbit

  • New Features
    • Added an option to disable padding in Markdown table cells. It’s enabled by default.
    • Tables remain valid when padding is disabled, including those with empty cells or pipes in cell content.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a public option to control table-cell padding. When padding is disabled, the table handler uses a minimum column width of one instead of content-based widths. The default remains padded output.

Changes: Table-Cell Padding

Layer / File(s) Summary
Padding option and table rendering
src/options.rs, src/element_handler/table.rs, tests/table/basic.rs, tests/turndown_cases/mod.rs
Options adds pad_table_cells, which defaults to true. The table handler uses content-based widths when padding is enabled and a minimum width of one when it is disabled. Tests cover disabled padding and the enabled setting in the Turndown cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: letmutex, bjones1

Merge Risk: Minimal · up to 32626

This adds an opt-out for table-cell padding. The default behavior is unchanged, so existing users are unaffected. Callers who build Options with a struct literal and no default-update syntax will need to add the new field, so a minor version bump may be appropriate.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add pad_table_cells option" names the main change: a new public option that controls whether table cells are padded to column width. The changeset adds the field to Options, uses it in tabl…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add pad_table_cells option" names the main change: a new public option that controls whether table cells are padded to column width. The changeset adds the field to Options, uses it in table_handler and compute_column_widths, and adds a test for the false case. The title is specific, short, and free of vague terms. It does not cover the default value or the compatibility impact, which the description does not require.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf00d907-f586-4ee4-840f-1a76a92a7269
Commits

Reviewing files that changed from the base of the PR and between f8284c8 and 32626ce.

Files selected for processing: 4

  • src/element_handler/table.rs
  • src/options.rs
  • tests/table/basic.rs
  • tests/turndown_cases/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@letmutex

Copy link
Copy Markdown
Owner

LGTM! Thanks for the contribution!

@letmutex
letmutex merged commit aa8e19c into letmutex:main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants