no inserting html tags into questions anymore

This commit is contained in:
mst 2024-11-26 15:11:13 +03:00
parent 9c9970b930
commit b7cb3f8247

View file

@ -420,11 +420,11 @@ def renderMarkdown(text):
'hr',
'img'
]
allowed_attrs = {
'a': 'href',
'button': 'class',
'img': ['src', 'width', 'height', 'alt', 'class', 'loading', 'title']
}
# allowed_attrs = {
# 'a': 'href',
# 'button': 'class',
# # 'img': ['src', 'width', 'height', 'alt', 'class', 'loading', 'title']
# }
# hard_wrap=True means that newlines will be
# converted into <br> tags
#
@ -437,10 +437,10 @@ def renderMarkdown(text):
plugins=plugins,
hard_wrap=True
)
html = md(text)
cleaner = Cleaner(tags=allowed_tags, attributes=allowed_attrs)
clean_html = cleaner.clean(html)
return Markup(clean_html)
cleaner = Cleaner(tags=allowed_tags)
clean_text = cleaner.clean(text)
html = md(clean_text)
return Markup(html)
def generateMetadata(question=None, answer=None):
metadata = {