mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 21:33:41 -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',
|
||||
'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 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue