Skip to content

Commit

Permalink
Merge pull request Alir3z4#373 from mborsetti/br_in_a
Browse files Browse the repository at this point in the history
Fix \n inside text of a Markdown link
  • Loading branch information
Alir3z4 authored Feb 22, 2022
2 parents 2ee4495 + f98dddd commit a3ed67b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion html2text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ def handle_tag(
self.p()

if tag == "br" and start:
if self.blockquote > 0:
if self.astack:
self.space = True
elif self.blockquote > 0:
self.o(" \n> ")
else:
self.o(" \n")
Expand Down
1 change: 1 addition & 0 deletions test/br_inside_a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="https://example.org/">This is a<br>test</a>
1 change: 1 addition & 0 deletions test/br_inside_a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[This is a test](https://example.com)

0 comments on commit a3ed67b

Please sign in to comment.