Skip to content

process_html_fragments() and friends may produce bad HTML #512

@Wuestengecko

Description

@Wuestengecko

Despite the name, process_html_fragments uses an XML serializer at the end. This means it may collapse empty elements into their short-hand closed form, like <div></div> into <div/>. These mean the same in XML, but an HTML parser will ignore the / and treat it as an opening <div> (which doesn't get closed explicitly). This can mess up nesting and cause all sorts of rendering issues.

MRE:

import capellambse.helpers
print(capellambse.helpers.replace_hlinks("<div></div>", None, None))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions