Currently django-htmlmin retains space around inline text elements. However, there are other inline/inline-block elements that still render whitespace around them that are currently not handled. Also, comment removal takes spaces outside the comment with it.
examples:
>>> from htmlmin.minify import html_minify
>>> html_minify('''<img src="http://example.com/image.jpg" alt="example"> hi''')
'<html><head></head><body><img alt="example" src="http://example.com/image.jpg"/>hi</body></html>'
>>> html_minify('''name: <input type="text">''')
'<html><head></head><body>name:<input type="text"/></body></html>'
>>> html_minify('''<p>a <!-- --> b</p>''')
'<html><head></head><body><p>ab</p></body></html>'
>>> html_minify('''<em>a <!-- --> b</em>''') # this works as `em` is a text context
'<html><head></head><body><em>a b</em></body></html>'
>>> html_minify('''<button> click me </button> text after''')
'<html><head></head><body><button>click me</button>text after</body></html>'
Some of these can be fixed by adding attributes to TEXT_FLOW, but they aren't really text elements so naming would probably need adjusting.
Currently django-htmlmin retains space around inline text elements. However, there are other inline/inline-block elements that still render whitespace around them that are currently not handled. Also, comment removal takes spaces outside the comment with it.
examples:
Some of these can be fixed by adding attributes to
TEXT_FLOW
, but they aren't really text elements so naming would probably need adjusting.