forked from CGM_Public/pretix_original
Do not parse list in rich_text_snippet
This commit is contained in:
@@ -109,15 +109,25 @@ def markdown_compile_email(source):
|
|||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
class SnippetExtension(markdown.extensions.Extension):
|
||||||
|
def extendMarkdown(self, md, *args, **kwargs):
|
||||||
|
del md.parser.blockprocessors['olist']
|
||||||
|
del md.parser.blockprocessors['ulist']
|
||||||
|
del md.parser.blockprocessors['quote']
|
||||||
|
|
||||||
|
|
||||||
def markdown_compile(source, snippet=False):
|
def markdown_compile(source, snippet=False):
|
||||||
tags = ALLOWED_TAGS_SNIPPET if snippet else ALLOWED_TAGS
|
tags = ALLOWED_TAGS_SNIPPET if snippet else ALLOWED_TAGS
|
||||||
|
exts = [
|
||||||
|
'markdown.extensions.sane_lists',
|
||||||
|
'markdown.extensions.nl2br'
|
||||||
|
]
|
||||||
|
if snippet:
|
||||||
|
exts.append(SnippetExtension())
|
||||||
return bleach.clean(
|
return bleach.clean(
|
||||||
markdown.markdown(
|
markdown.markdown(
|
||||||
source,
|
source,
|
||||||
extensions=[
|
extensions=exts
|
||||||
'markdown.extensions.sane_lists',
|
|
||||||
'markdown.extensions.nl2br'
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
strip=snippet,
|
strip=snippet,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
|||||||
Reference in New Issue
Block a user