Skip to content

md_in_html: broken code span #1068

Description

@dbader

markdown.extensions.md_in_html fails to escape HTML tags in monospace text placed inside a markdown="1" div wrapper:

>>> import markdown
>>> markdown.markdown('<div markdown="1">\n`<h1>escaped</h1>`\n</div>', extensions=["markdown.extensions.md_in_html"])
'<p><h1><div markdown="block">\n`escaped&lt;/h1&gt;`\n</div></p>'
<p><h1><div markdown="block">
`escaped&lt;/h1&gt;`
</div></p>

The inner <code> element should look like this: <code>&lt;h1&gt;escaped&lt;/h1&gt;</code>, but instead the h1 inside the monospace text appears as an actual <h1> tag in the output.

Versions

  • Markdown==3.3.3
  • CPython 3.8.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions