Closed dreikanter closed 11 years ago
I feel like I must be missing something, but reading the diff it seems like the latest version calls a version of md_escape that doesn't do any escaping. Furthermore, the special characters in the tests aren't escaped either (which is presumably why they passed).
>>> import re
>>> md_chars_matcher = re.compile(r"([\\`\*_{}\[\]\(\)#\+-\.!])")
>>> md_chars_matcher.sub(r"\1", '(x)f')
'(x)f'
I forgot to push local changes before pull request, sorry. Now it should be ok.
Looks good, thanks!
I found another bug: URLs containing unencoded brackets and parenthesis could break markdown links and images syntax when INLINE_LINKS = True. For example the following code:
will be transformed to
which will give the following MD transformation result (tested with python-markdown and dillinger.io):
The same problem could appear with image source values. This case is not very common but some sites (e.g. MSDN) actively uses parenthesis in URLs.
I've fixed this by escaping parenthesis and brackets, so the result will produce correct HTML:
This patch includes bugfix and new test case for URL escaping.