matthewwithanm/python-markdownify

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

Closed this issue · 0 comments

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.