Skip to content

Tables are being removed when the diff adds ins or del tags wrapping tbody/thead/tfoot tags#21

Open
stefanbrand-rldatix wants to merge 4 commits intomasterfrom
tables_being_removed
Open

Tables are being removed when the diff adds ins or del tags wrapping tbody/thead/tfoot tags#21
stefanbrand-rldatix wants to merge 4 commits intomasterfrom
tables_being_removed

Conversation

@stefanbrand-rldatix
Copy link
Copy Markdown

@stefanbrand-rldatix stefanbrand-rldatix commented Apr 7, 2026

Include the tbody/thead/tfoot tags in the fix_tables clean up to move the ins and del tags inside the td and th tags. This prevents the complete removal of the table contents in these cases.

@stefanbrand-rldatix stefanbrand-rldatix self-assigned this Apr 7, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an HTML diff cleanup edge case where tables could lose their contents when <ins>/<del> wraps table section elements (<tbody>, <thead>, <tfoot>), by ensuring those change markers get pushed down into <td>/<th> instead of remaining at invalid table-structure levels.

Changes:

  • Extend table cleanup to internalize/distribute <ins>/<del> for <tbody>/<thead>/<tfoot> (and also <tr>) so markers end up inside cells.
  • Add comprehensive regression tests covering tbody/thead/tfoot wrapped by ins/del, plus paired del+ins internalization cases.
  • Bump package version to 0.3.1.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
setup.py Version bump for the release including the table diff fix.
htmltreediff/html.py Updates fix_tables() to internalize/distribute change markup for table section elements and rows before final cleanup.
htmltreediff/test_html.py Adds regression tests covering the table-section-wrapped ins/del scenarios and internalization behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread htmltreediff/html.py
Comment thread htmltreediff/html.py
@stefanbrand-rldatix
Copy link
Copy Markdown
Author

All tests pass locally

Ran 529 tests in 0.637s

OK

Copy link
Copy Markdown

@chrisbailey-rldatix chrisbailey-rldatix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

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.

3 participants