diff --git a/markdownify/__init__.py b/markdownify/__init__.py
index eaa58c1..f9b5f9b 100644
--- a/markdownify/__init__.py
+++ b/markdownify/__init__.py
@@ -370,7 +370,7 @@ def convert_table(self, el, text, convert_as_inline):
return '\n\n' + text + '\n'
def convert_td(self, el, text, convert_as_inline):
- return ' ' + text.strip() + ' |'
+ return ' ' + text.strip().replace("\n", " ") + ' |'
def convert_th(self, el, text, convert_as_inline):
return ' ' + text + ' |'
diff --git a/tests/test_tables.py b/tests/test_tables.py
index e0c07ea..334bfb7 100644
--- a/tests/test_tables.py
+++ b/tests/test_tables.py
@@ -57,6 +57,26 @@
"""
+table_with_linebreaks = """
+
+ Firstname |
+ Lastname |
+ Age |
+
+
+ Jill |
+ Smith
+ Jackson |
+ 50 |
+
+
+ Eve |
+ Jackson
+ Smith |
+ 94 |
+
+
"""
+
table_with_header_column = """
@@ -164,6 +184,7 @@ def test_table():
assert md(table) == '\n\n| Firstname | Lastname | Age |\n| --- | --- | --- |\n| Jill | Smith | 50 |\n| Eve | Jackson | 94 |\n\n'
assert md(table_with_html_content) == '\n\n| Firstname | Lastname | Age |\n| --- | --- | --- |\n| **Jill** | *Smith* | [50](#) |\n| Eve | Jackson | 94 |\n\n'
assert md(table_with_paragraphs) == '\n\n| Firstname | Lastname | Age |\n| --- | --- | --- |\n| Jill | Smith | 50 |\n| Eve | Jackson | 94 |\n\n'
+ assert md(table_with_linebreaks) == '\n\n| Firstname | Lastname | Age |\n| --- | --- | --- |\n| Jill | Smith Jackson | 50 |\n| Eve | Jackson Smith | 94 |\n\n'
assert md(table_with_header_column) == '\n\n| Firstname | Lastname | Age |\n| --- | --- | --- |\n| Jill | Smith | 50 |\n| Eve | Jackson | 94 |\n\n'
assert md(table_head_body) == '\n\n| Firstname | Lastname | Age |\n| --- | --- | --- |\n| Jill | Smith | 50 |\n| Eve | Jackson | 94 |\n\n'
assert md(table_missing_text) == '\n\n| | Lastname | Age |\n| --- | --- | --- |\n| Jill | | 50 |\n| Eve | Jackson | 94 |\n\n'