Markdown in HTML

To include Markdown components within HTML elements within a Markdown file in Python Markdown you need to add the (official) extension Markdown in HTML and an attribute.

html_content = markdown.markdown(
<details markdown="1">
    <summary markdown="block">
        ## Appendix: Some Generative Art

    Some images I generated with DALLĀ·E:



"1" uses the default behaviour of the element, "block" forces it to use block behaviour on the contents of the element, and "span" forces the element to use span behaviour on its contents.