mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
HTML Sanitizer: Allow the class attribute
This commit is contained in:
@@ -25,6 +25,8 @@ ALLOWED_TAGS = [
|
|||||||
'tr',
|
'tr',
|
||||||
'td',
|
'td',
|
||||||
'th',
|
'th',
|
||||||
|
'div',
|
||||||
|
'span'
|
||||||
]
|
]
|
||||||
|
|
||||||
ALLOWED_ATTRIBUTES = {
|
ALLOWED_ATTRIBUTES = {
|
||||||
@@ -33,6 +35,9 @@ ALLOWED_ATTRIBUTES = {
|
|||||||
'acronym': ['title'],
|
'acronym': ['title'],
|
||||||
'table': ['width'],
|
'table': ['width'],
|
||||||
'td': ['width', 'align'],
|
'td': ['width', 'align'],
|
||||||
|
'div': ['class'],
|
||||||
|
'p': ['class'],
|
||||||
|
'span': ['class'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -41,5 +46,9 @@ def rich_text(text: str, **kwargs):
|
|||||||
"""
|
"""
|
||||||
Processes markdown and cleans HTML in a text input.
|
Processes markdown and cleans HTML in a text input.
|
||||||
"""
|
"""
|
||||||
body_md = bleach.linkify(bleach.clean(markdown.markdown(text), tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES))
|
body_md = bleach.linkify(bleach.clean(
|
||||||
|
markdown.markdown(text),
|
||||||
|
tags=ALLOWED_TAGS,
|
||||||
|
attributes=ALLOWED_ATTRIBUTES,
|
||||||
|
))
|
||||||
return mark_safe(body_md)
|
return mark_safe(body_md)
|
||||||
|
|||||||
Reference in New Issue
Block a user