Skip to content
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 extra newline bug #363

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions html2text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def feed(self, data: str) -> None:
super().feed(data)

def handle(self, data: str) -> str:
self.start = True
self.feed(data)
self.feed("")
markdown = self.optwrap(self.finish())
Expand Down
12 changes: 12 additions & 0 deletions test/test_newlines_on_multiple_calls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import html2text

# See https://github.com/Alir3z4/html2text/issues/163 for more information.


def test_newline_on_multiple_calls():
h = html2text.HTML2Text()
html = "<p>test</p>"
md1 = h.handle(html)
md2 = h.handle(html)
md3 = h.handle(html)
assert md1 == md2 == md3
Loading