Skip to content

fix: prevent orphaned headings at page breaks#2

Merged
araa47 merged 5 commits intomainfrom
fix/heading-orphans-and-readme
Mar 22, 2026
Merged

fix: prevent orphaned headings at page breaks#2
araa47 merged 5 commits intomainfrom
fix/heading-orphans-and-readme

Conversation

@araa47
Copy link
Copy Markdown
Owner

@araa47 araa47 commented Mar 22, 2026

Summary

  • Fix orphaned headings: Headings no longer render alone at the bottom of a page with content flowing to the next. Uses CondPageBreak, KeepTogether, and keepWithNext for robust prevention.
  • Add tests: Structural tests verify CondPageBreak/KeepTogether are emitted for headings, plus keepWithNext on all heading styles, plus an integration test with a long document.
  • Bump to v0.2.0 with a new CHANGELOG.md.
  • Improve README: badges, features section, better structure for open source.

Thanks to @0xlaveen for identifying this issue and proposing the original fix in #1 — this PR supersedes that one with tests and additional improvements.

Test plan

  • All 32 existing + new tests pass (uv run pytest)
  • Structural test verifies 3 CondPageBreak + 3 KeepTogether for 3 headings
  • Style test verifies keepWithNext=True on all 6 heading levels
  • Integration test generates a 20-section document and validates PDF output

Closes #1

🤖 Generated with Claude Code

- Add CondPageBreak before headings to avoid orphans at page bottom
- Wrap heading + decorators in KeepTogether for atomic rendering
- Set keepWithNext=True on all heading styles
- Add structural and integration tests for orphan prevention
- Bump version to 0.2.0
- Add CHANGELOG.md
- Improve README with badges, features section, and better structure

Thanks to @0xlaveen for identifying the orphaned heading issue in #1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
araa47 and others added 4 commits March 23, 2026 00:37
- Fix ty type error with TypedDict for HEADING_DEFS
- Fix ty no-matching-overload for subprocess.run in tests
- Add ignore-spelling-words.txt for codespell
- Auto-format with black/ruff
- Add transparent logo to assets/
- Fix empty.md end-of-file

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@araa47 araa47 merged commit c96c629 into main Mar 22, 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.

1 participant