Skip to content

write_html: ignore a NaN or infinite line-height, like an invalid one - #2125

Merged
andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:html-line-height-finite
Nov 7, 2026
Merged

andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:html-line-height-finite

Conversation

@RavSinghChandan

Copy link
Copy Markdown

write_html('<p line-height="inf">a</p>') never returned: the infinite line height kept the renderer looping. The same happens on <ul> and <ol>. With line-height="nan" the list items were silently dropped.

A NaN or infinite line-height is now ignored like an invalid one (line-height="x"), so the default is used. The three places that parsed it now share a small _parse_line_height() helper.

  • A unit test is covering the code added / modified by this PR
  • A mention of the change is present in CHANGELOG.md
  • This PR is ready to be merged

@andersonhc
andersonhc merged commit 4f6d7a3 into py-pdf:master Nov 7, 2026
23 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