Skip to content

write_html: treat all HTML void elements as having no end tag - #2053

Merged
andersonhc merged 1 commit into
py-pdf:masterfrom
RavSinghChandan:html-void-elements
Oct 22, 2026
Merged

andersonhc merged 1 commit into
py-pdf:masterfrom
RavSinghChandan:html-void-elements

Conversation

@RavSinghChandan

Copy link
Copy Markdown

write_html() logs "Missing HTML end tag for " and "Unexpected HTML end tag , start tag was " for a normal HTML email head, because <meta> is not in HTML_UNCLOSED_TAGS. The same happens for the other void elements, which never have an end tag in HTML: <link>, <col>, <wbr>, <input>, <base>, <area>, <embed>, <source> and <track>. Only <br>, <hr> and <img> were listed.

All HTML void elements are now in HTML_UNCLOSED_TAGS, so they leave the tag stack like <br> does, and valid HTML no longer produces these warnings. Real mismatches are still reported (test_warn_on_tags_not_matching is unchanged). Added a test with a typical email <head>, a <colgroup>, <wbr> and <input>.

@andersonhc
andersonhc merged commit 14c0c10 into py-pdf:master Oct 22, 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