diff --git a/html2text/__init__.py b/html2text/__init__.py index 7e1a279..c59ae16 100644 --- a/html2text/__init__.py +++ b/html2text/__init__.py @@ -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") diff --git a/test/br_inside_a.html b/test/br_inside_a.html new file mode 100644 index 0000000..b8ad150 --- /dev/null +++ b/test/br_inside_a.html @@ -0,0 +1 @@ +This is a
test
diff --git a/test/br_inside_a.md b/test/br_inside_a.md new file mode 100644 index 0000000..8997d9b --- /dev/null +++ b/test/br_inside_a.md @@ -0,0 +1 @@ +[This is a test](https://example.com)