Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #6387 -- Updated markdown filter to handle markdown-1.7 as well as

earlier versions. Patch from cogg, jedie and Dmitri Fedortchenko.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7423 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8453a1750f4ba2925bcccd775def0d8d255d6b99 1 parent ea87c0d
@malcolmt malcolmt authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/contrib/markup/templatetags/markup.py
View
8 django/contrib/markup/templatetags/markup.py
@@ -65,7 +65,13 @@ def markdown(value, arg=''):
safe_mode = True
else:
safe_mode = False
- return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
+
+ # Unicode support only in markdown v1.7 or above. Version_info
+ # exist only in markdown v1.6.2rc-2 or above.
+ if getattr(markdown, "version_info", None) < (1,7):
+ return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
+ else:
+ return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
else:
return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
markdown.is_safe = True

0 comments on commit 8453a17

Please sign in to comment.
Something went wrong with that request. Please try again.