diff --git a/markdownify/__init__.py b/markdownify/__init__.py index fcdc32a..3bda85e 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -245,6 +245,7 @@ class MarkdownConverter(object): columns = row.find_all('td') if len(headers) > 0: headers = [head.text.strip() for head in headers] + headers = [head for head in headers if head] text_data.append(' | '.join(headers)) text_data.append(' | '.join(['---'] * len(headers))) elif len(columns) > 0: diff --git a/tests/test_conversions.py b/tests/test_conversions.py index 2d2e825..de3307f 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -67,11 +67,11 @@ table_head_body = re.sub(r'\s+', '', """ """) -table_missing_header = re.sub(r'\s+', '', """ +table_missing_text = re.sub(r'\s+', '', """
| + | Firstname | Lastname | Age |
|---|---|---|---|
| Jill | -Smith | +50 | |