Apply nl2br and urlize to Markdown for better usability

This commit is contained in:
Yingtong Li 2019-03-17 23:27:25 +11:00
parent 66de568c69
commit 8fad94cd80
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 2 additions and 1 deletions

View File

@ -8,3 +8,4 @@ google-api-python-client==1.7.7
django-ratelimit==2.0.0
boto3==1.9.86
premailer==3.2.0
markdown-urlize==0.2.0

View File

@ -42,6 +42,6 @@ def environment(**options):
'MEDIA_URL': settings.MEDIA_URL,
})
env.filters.update({
'markdown': lambda x: Markup(markdown.markdown(x))
'markdown': lambda x: Markup(markdown.markdown(x, extensions=['nl2br', 'mdx_urlize']))
})
return env