Closed kthy closed 2 years ago
How very strange. I do apologies and will investigate. Thanks so much for the feedback it's appreciated.
In the shorterm please accept my apology and hopefully you can use another lib to beautifying. i.e.
output = render(html(body(h1('Hello, World!'))))
from html5print import HTMLBeautifier
print(HTMLBeautifier.beautify(output, 4))
and I will look into fixing this as soon as possible.
the doc type with str a bit harder in short term. it's part of a re-architecture requirement where my DOM needs to have a top level node. very sorry but you would have to prepend that manually until that gets figured out.
to explain what i mean by this. at the moment my dom can't have a comment outside the html tag for example. as it is the root node. while its illegal to have multiple nodes on a root it still should be possible. and hence other library dom builders don't quite map to mine yet. i.e. the hacks i had to do to expat parser. anyway I'm hoping to get into fixing that so it's compatible with html5lib for example. But it could take some time.
thanks for your patience and trying out the lib also. It helps me a lot ot get people using it and giving feedback.
No need to apologise, you've written a very useful library! Thanks for considering my feedback - there's probably more to come … :wink:
When converting the
html
object withstr
and returning it as a response, closing tags for void elements likemeta
are correctly omitted.When converting it in an f-string and returning it as a response, closing tags are erroneously included. Example of a simple Sanic route:
which generates the following HTML:
Note the errant
</meta>
on line 5. For comparison, the output withreturn response.html(str(four_oh_four))
isbut then I don't get the doctype element.