]>
git.p6c8.net - pcdenotes.git/blob - notes/templatetags/notes_extras.py
3cdb2333798ab459b92b2836448da1cce99c67a2
1 from django
import template
2 from django
.template
.defaultfilters
import stringfilter
5 from markdown
.extensions
import Extension
7 register
= template
.Library()
9 # See https://python-markdown.github.io/change_log/release-3.0/#safe_mode-and-html_replacement_text-keywords-deprecated
10 class EscapeHtml(Extension
):
11 def extendMarkdown(self
, md
):
12 md
.preprocessors
.deregister('html_block')
13 md
.inlinePatterns
.deregister('html')
18 return md
.markdown(value
, extensions
=[EscapeHtml(), 'nl2br'])
patrick-canterino.de