-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URLs with parenthesis are broken #46
Comments
I see. You have |
It seems the URL string need to be normalized. Using from werkzeug.urls import url_parse, url_quote
def safe_url(url):
parsed = url_parse(url)
path = url_quote(parsed.path, safe='/%')
query = url_quote(parsed.query, safe='?=&')
return parsed.replace(path=path, query=query).to_url()
url = 'https://trello-attachments.s3.amazonaws.com/550878b58559170febf8e69b/500x600/ff07160366332b3962320bdfb1693e3e/download_(2).jpg'
print mistune.markdown("here's a [URL](%s)" % safe_url(url)) There is a similar solution in douban/brownant. |
In case that you need to render links with ")" like #46, you need to wrap it in `<` and `>`.
It is not easy to write a proper regex for this situation. I've fix the situation in this case:
You need to wrap the link with |
Not really solved, but a workaround. |
Can I wrap every link, no only the ones with |
@fiatjaf yes. |
The text was updated successfully, but these errors were encountered: