Incorrectly removing whitespace from `white-space: pre-wrap` styled tag
ElliotKillick opened this issue · 2 comments
Hi!
I just encountered this bug myself and had to do a Git bisect to track down root cause:
Whitespace should not be minimized when a white-space: pre-wrap
style is in use because it effects how the content is displayed in that case.
This is a general caveat with the context-aware approach as it assumes that the input follows semantic HTML. In this case using the more semantic <pre>
would trigger the appropriate whitespace minification ruleset (as per the README). Trying to detect via CSS rules would be too complex: while it could work in this limited case (inline styles), it would be very expensive and there would be expectations of consistent handling of <style>, external styles, classes, etc., none of which are possible. I would prefer to utilise the semantic HTML rules anyway. Although I think having the ability to map specific classes to specific whitespace minification options would be interesting.
Tracking the feature at #167.