mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-20 13:53:42 -05:00
no inserting html tags into questions anymore
This commit is contained in:
parent
9c9970b930
commit
b7cb3f8247
1 changed files with 9 additions and 9 deletions
18
functions.py
18
functions.py
|
@ -420,11 +420,11 @@ def renderMarkdown(text):
|
||||||
'hr',
|
'hr',
|
||||||
'img'
|
'img'
|
||||||
]
|
]
|
||||||
allowed_attrs = {
|
# allowed_attrs = {
|
||||||
'a': 'href',
|
# 'a': 'href',
|
||||||
'button': 'class',
|
# 'button': 'class',
|
||||||
'img': ['src', 'width', 'height', 'alt', 'class', 'loading', 'title']
|
# # 'img': ['src', 'width', 'height', 'alt', 'class', 'loading', 'title']
|
||||||
}
|
# }
|
||||||
# hard_wrap=True means that newlines will be
|
# hard_wrap=True means that newlines will be
|
||||||
# converted into <br> tags
|
# converted into <br> tags
|
||||||
#
|
#
|
||||||
|
@ -437,10 +437,10 @@ def renderMarkdown(text):
|
||||||
plugins=plugins,
|
plugins=plugins,
|
||||||
hard_wrap=True
|
hard_wrap=True
|
||||||
)
|
)
|
||||||
html = md(text)
|
cleaner = Cleaner(tags=allowed_tags)
|
||||||
cleaner = Cleaner(tags=allowed_tags, attributes=allowed_attrs)
|
clean_text = cleaner.clean(text)
|
||||||
clean_html = cleaner.clean(html)
|
html = md(clean_text)
|
||||||
return Markup(clean_html)
|
return Markup(html)
|
||||||
|
|
||||||
def generateMetadata(question=None, answer=None):
|
def generateMetadata(question=None, answer=None):
|
||||||
metadata = {
|
metadata = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue