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))
Despite the name,
process_html_fragmentsuses 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: