Skip to content

Commit

Permalink
Remove redundant <br>'s after block tags when converting from Telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Oct 29, 2023
1 parent 90a8583 commit a84e5eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mautrix_telegram/formatter/from_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,11 @@ def text_to_html(
last_offset = relative_offset + (0 if skip_entity else entity.length)
html.append(text_to_html(text[last_offset:]))

return "".join(html)
html_string = "".join(html)
# Remove redundant <br>'s after block tags
html_string = html_string.replace("</blockquote><br/>", "</blockquote>")
html_string = html_string.replace("</pre><br/>", "</pre>")
return html_string


def _parse_pre(html: list[str], entity_text: str, language: str) -> bool:
Expand Down

0 comments on commit a84e5eb

Please sign in to comment.