forked from AFPy/PonyConf
Add support for markdown images
This commit is contained in:
parent
9292862fe4
commit
b6ace61f48
|
@ -16,6 +16,7 @@ class PonyConfModel(models.Model):
|
|||
|
||||
def markdown_to_html(md):
|
||||
html = markdown(md)
|
||||
allowed_tags = bleach.ALLOWED_TAGS + ['p', 'pre', 'span' ] + ['h%d' % i for i in range(1, 7) ]
|
||||
html = bleach.clean(html, tags=allowed_tags)
|
||||
allowed_tags = bleach.ALLOWED_TAGS + ['p', 'pre', 'span', 'img'] + ['h%d' % i for i in range(1, 7) ]
|
||||
allowed_attributes = bleach.ALLOWED_ATTRIBUTES['img'] = ['src', 'alt']
|
||||
html = bleach.clean(html, tags=allowed_tags, attributes=allowed_attributes)
|
||||
return mark_safe(html)
|
||||
|
|
Loading…
Reference in New Issue
Block a user