1 Commits

Author SHA1 Message Date
Patrick
c70ab31abd fix: add leading/trailing pipes to GFM tables (pad_tables=False)
When pad_tables=False (default), html2text generated table rows without
leading/trailing pipe delimiters, producing non-compliant GFM markdown:

  Before: A | B | C
  After:  | A | B | C |

Changes:
- Add leading pipe on first cell, spaced pipe between cells
- Add trailing pipe at end of each row
- Format separator as | --- | --- | instead of ---|---
- Ensure table starts on its own line (soft_br at <table>)
- Handle <caption> element to prevent inline merge with header row
- All changes guarded by `not self.pad_tables` — pad_tables mode unchanged

Includes 13 unit tests covering GFM compliance and pad_tables regression.

Fixes: #1731
2026-02-17 21:14:36 -05:00