trentm / python-markdown2

markdown2: A fast and complete implementation of Markdown in Python
Other
2.66k stars 433 forks source link

Fix backslash being unable to escape raw HTML tags #486

Closed Crozzers closed 1 year ago

Crozzers commented 1 year ago

This PR fixes #386, allowing the use of backslashes to escape HTML tags, auto-links and HTML comments.

It works by checking for pairs of backslashes preceding any markup. If there are 0 or more pairs of backslashes (eg: \\\\) then they escape themselves. If there is an odd number of backslashes then the markup has been escaped.

nicholasserra commented 1 year ago

LGTM thanks!