Skip to content

Instantly share code, notes, and snippets.

@defrex
Created August 9, 2013 15:23
Show Gist options
  • Save defrex/6194514 to your computer and use it in GitHub Desktop.
Save defrex/6194514 to your computer and use it in GitHub Desktop.
`django.contrib.markup` is deprecated in Django 1.5. Here is a simple replacement for the markdown filter.
import markdown as mkdn
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter()
def markdown(value):
return mark_safe(mkdn.markdown(value, safe_mode='escape'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment