Skip to content

<a> tag links should not be constructed inside preformatted tags #164

@chrispy-snps

Description

@chrispy-snps

The conversion for <a> tags creates links inside <code> and <pre> tags:

from markdownify import markdownify as md

print(md("<code><a href='http://foo.com/'>foo.com</a></code>"))
# `[foo.com](http://foo.com/)`

print(md("<pre><a href='http://foo.com/'>foo.com</a></pre>"))
# ```
# [foo.com](http://foo.com/)
# ```

This is incorrect because content inside Markdown code spans and code blocks is interpreted literally. In these cases, the tags should be rendered as plaintext.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions