-
Notifications
You must be signed in to change notification settings - Fork 23
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
How to keep line breaks #28
Comments
There's no such option to disable whitespace normalization here. Idk why so. I faced the same issue with telegram, so I used this initial_text = "<strong>kek</strong>\n\n<s>lol</s>"
message = Sanitizer({
"tags": {'a', 'br', 'b', 'strong', 'i', 'em', 'code', 's', 'strike', 'del', 'u'},
"attributes": {},
"whitespace": {},
'empty': {'a', 'br'},
'separate': {'br'},
}).sanitize(initial_text.replace("\n", "<br>")).replace("<br>", "\n")
bot.send_message(message) |
I have similar problem with
|
|
matthiask
added a commit
that referenced
this issue
Jan 3, 2024
+1 on this, I am integrating user-inputted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Guys could you provide help, how to keep line breaks.
I have a text with paragraphs
<p>First sentence</p>\n<p>Next one</p>
I want to satanize it for Telegram bot which don't like
<p>
, but seems that paired tags cannot be transformed to something like\n
.Line breaks
\n
in original text also become wiped.I'll be grateful for any ideas
The text was updated successfully, but these errors were encountered: