New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix stripping block-level tags (#369) #651
Conversation
This adds comments for what we're doing and why.
@g-k Can you eyeball this? I'm pretty sure it's fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+ lgtm
tests/test_clean.py
Outdated
"This is our description! &\nnice!", | ||
), | ||
( | ||
# double-wrap causes an initial newline--this can"t really be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra nitty nit: the apostrophe is rendering with a double quote in can"t
Does it make sense to make this optional? (Other than via monkey patching |
I'm going to evaluate "does it make sense" in terms of "users have expressed a need" and so far I haven't seen anyone express a need to make this optional. In my uses of Bleach, having the additional newlines would have been fine. Given that, I think the answer at this time should be no. If someone has a need, they can write up an issue and we can evaluate things from there. |
When Bleach strips a block-level element, it should replace it with a newline preserving the whitespace that would exist if it was being parsed by a browser.
Fixes #369.
This supersedes PR #642.