Ticket #10146: markup_extension_configs.diff

File markup_extension_configs.diff, 1.2 KB (added by bdejong, 14 years ago)

markdown extension_configs patch, svn revision 9791 version

  • markup.py

     
    6666            else:
    6767                safe_mode = False
    6868
     69            # if there are extension configs in the settings, get them
     70            extension_configs = getattr(settings, "MARKDOWN_FILTER_SETTINGS", {})
     71            md = markdown.Markdown(extensions=extensions, extension_configs=extension_configs, safe_mode=safe_mode)
     72           
    6973            # Unicode support only in markdown v1.7 or above. Version_info
    7074            # exist only in markdown v1.6.2rc-2 or above.
    7175            if getattr(markdown, "version_info", None) < (1,7):
    72                 return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
     76                return mark_safe(force_unicode(md.convert(force_unicode(value))))
    7377            else:
    74                 return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
     78                return mark_safe(md.convert(force_unicode(value)))
    7579        else:
    7680            return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
    7781markdown.is_safe = True
Back to Top