Repository: Python-Markdown/markdown (python)

Issue:
Some elements turning into None in html output with md_in_html
```python
import markdown
md = markdown.Markdown(extensions=["markdown.extensions.md_in_html"])
test = """
<div class="output_area" markdown="1">
<table>
<thead><tr>
<th style="text-align:right"></th>
<th style="text-align:right">time</th>
<th style="text-align:right">amplitude</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
</tr>
</tbody>
</table>
</div>
"""
print(md.convert(test))
```

Which gives me -

```html
<div class="output_area">
<table>
<thead>None<tr>
<th style="text-align:right">None</th>
<th style="text-align:right">time</th>
<th style="text-align:right">amplitude</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
</tr>
</tbody>
</table>
</div>
```

Rather than

```html
<div class="output_area">
<table>
<thead><tr>
<th style="text-align:right"></th>
<th style="text-align:right">time</th>
<th style="text-align:right">amplitude</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
</tr>
</tbody>
</table>
</div>
```

Which is what I'm expecting - note the extra `None` before the `<tr>` in `<thead>` and in the first header.

Pull request description:
Ensure when tag text is None that it is converted to empty string
Fixes #1049

Patch:
diff --git a/docs/change_log/index.md b/docs/change_log/index.md
index 994e9a2..fffa216 100644
--- a/docs/change_log/index.md
+++ b/docs/change_log/index.md
@@ -6,6 +6,7 @@ Python-Markdown Change Log
 Under development: version 3.3.3 (a bug-fix release).
 
 * Unify all block-level tags (#1047).
+* Fix issue where some empty elements would have text rendered as `None` when using `md_in_html` (#1049).
 
 Oct 19, 2020: version 3.3.2 (a bug-fix release).
 
diff --git a/markdown/extensions/md_in_html.py b/markdown/extensions/md_in_html.py
index 489c3fe..a2137c7 100644
--- a/markdown/extensions/md_in_html.py
+++ b/markdown/extensions/md_in_html.py
@@ -260,6 +260,8 @@ class MarkdownInHtmlProcessor(BlockProcessor):
 
         else:
             # Disable inline parsing for everything else
+            if element.text is None:
+                element.text = ''
             element.text = util.AtomicString(element.text)
             for child in list(element):
                 self.parse_element_content(child)


Test patch:
diff --git a/tests/test_syntax/extensions/test_md_in_html.py b/tests/test_syntax/extensions/test_md_in_html.py
index 946e922..865007f 100644
--- a/tests/test_syntax/extensions/test_md_in_html.py
+++ b/tests/test_syntax/extensions/test_md_in_html.py
@@ -390,6 +390,24 @@ class TestMdInHTML(TestCase):
             )
         )
 
+    def test_empty_tags(self):
+        self.assertMarkdownRenders(
+            self.dedent(
+                """
+                <div markdown="1">
+                <div></div>
+                </div>
+                """
+            ),
+            self.dedent(
+                """
+                <div>
+                <div></div>
+                </div>
+                """
+            )
+        )
+
     def test_orphan_end_tag_in_raw_html(self):
         self.assertMarkdownRenders(
             self.dedent(