@register.filter
def html_thumbnails(value):
    return mark_safe(text_filter('<img(?: alt="(%(caption)s)?")? src="(%(image)s)"', value))
HTML filter that replaces all images with thumbnails, the returned string is marked as safe.
dataset/ETHPy150Open python-thumbnails/python-thumbnails/thumbnails/templatetags/thumbnails.py/html_thumbnails