Skip to content

Commit

Permalink
fix: HTML formatter producing invalid HTML
Browse files Browse the repository at this point in the history
Resulting from lxml element tostring called with method using default
"xml" value
  • Loading branch information
cheywood committed Jan 29, 2025
1 parent afd5b00 commit 84e0c01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/formatters/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _format(self, text:str, indents:int):

doc_root = html.fromstring(text)
etree.indent(doc_root, space=indent_str)
return etree.tostring(doc_root, encoding='unicode', pretty_print=True)
return etree.tostring(doc_root, method='html', encoding='unicode', pretty_print=True)

def is_correct(self, text:str) -> bool:
if isinstance(text, str):
Expand Down

0 comments on commit 84e0c01

Please sign in to comment.