‹› markdown.serializers

Python-Markdown provides two serializers which render ElementTree.Element objects to a string of HTML. Both functions wrap the same underlying code with only a few minor differences as outlined below:

  1. Empty (self-closing) tags are rendered as <tag> for HTML and as <tag /> for XHTML.
  2. Boolean attributes are rendered as attrname for HTML and as attrname="attrname" for XHTML.

‹› markdown.serializers.to_html_string(element: Element) -> str

Serialize element and its children to a string of HTML5.

‹› markdown.serializers.to_xhtml_string(element: Element) -> str

Serialize element and its children to a string of XHTML.