mirror of
https://github.com/ae-utbm/sith3.git
synced 2024-07-08 22:36:02 +00:00
18 lines
351 B
Python
18 lines
351 B
Python
import mistune
|
|
from django import template
|
|
from django.template.defaultfilters import stringfilter
|
|
from django.utils.safestring import mark_safe
|
|
from django.utils.html import escape
|
|
|
|
|
|
register = template.Library()
|
|
|
|
@register.filter(is_safe=False)
|
|
@stringfilter
|
|
def markdown(text):
|
|
md = mistune.Markdown()
|
|
return mark_safe(md(escape(text)))
|
|
|
|
|
|
|