Skip to content

Some elements turning into None in html output with md_in_html #1049

Closed
@greenape

Description

@greenape
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 -

<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

<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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.confirmedConfirmed bug report or approved feature request.extensionRelated to one or more of the included extensions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions