Skip to content

write_html: ignore an invalid CSS color on a heading, like browsers - #2075

Merged
andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:html-heading-invalid-css-color
Oct 29, 2026
Merged

andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:html-heading-invalid-css-color

Conversation

@RavSinghChandan

Copy link
Copy Markdown

<h1 style="color: nope"> raised ValueError: nope does not start with #. Browsers ignore an invalid CSS declaration, so the heading now keeps its color attribute or its default color, like an invalid style value elsewhere in write_html(). Legacy color/bgcolor attributes are unchanged.

  • 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

Comment thread fpdf/html.py Resolved
@andersonhc
andersonhc merged commit 3992f86 into py-pdf:master Oct 29, 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