Skip to content

Incomplete list of empty HTML tags leads to invalid HTML #1353

Closed
@nicbou

Description

@nicbou

I have made an extension to replace <img> tags with <figure> and <picture> tags. This is the expected output:

<picture>
    <source ...>
    <img ...>
</picture>

Unfortunately, the <source> element has a closing </source> tag. That's invalid HTML. I traced it to this line in the code. The source element is missing from Python Markdown's internal list of empty elements.

The full list of empty elements includes:

<area>
<base>
<br>
<col>
<embed>
<hr>
<img>
<input>
<link>
<meta>
<param> (deprecated)
<source>
<track>
<wbr>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.confirmedConfirmed bug report or approved feature request.coreRelated to the core parser code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions