Merge pull request #150 from taigaio/issue/1532/markdown-problems
Adding br an ins to the whitelist of the bleach tagsremotes/origin/enhancement/email-actions
commit
257ed89b04
|
@ -51,13 +51,16 @@ from .extensions.mentions import MentionsExtension
|
||||||
from .extensions.references import TaigaReferencesExtension
|
from .extensions.references import TaigaReferencesExtension
|
||||||
|
|
||||||
|
|
||||||
ALLOWED_TAGS = bleach.ALLOWED_TAGS + ["p", "table", "th", "tr", "td", "h1",
|
# Bleach configuration
|
||||||
"h2", "h3", "div", "pre", "span", "hr", "dl", "dt", "dd", "sup",
|
bleach.ALLOWED_TAGS += ["p", "table", "th", "tr", "td", "h1", "h2", "h3",
|
||||||
"img", "del"]
|
"div", "pre", "span", "hr", "dl", "dt", "dd", "sup",
|
||||||
ALLOWED_ATTRS = bleach.ALLOWED_ATTRIBUTES
|
"img", "del", "br", "ins"]
|
||||||
ALLOWED_ATTRS["a"] = ["href", "title", "alt"]
|
|
||||||
ALLOWED_ATTRS["img"] = ["alt", "src"]
|
bleach.ALLOWED_STYLES.append("background")
|
||||||
ALLOWED_ATTRS["*"] = ["class"]
|
|
||||||
|
bleach.ALLOWED_ATTRIBUTES["a"] = ["href", "title", "alt"]
|
||||||
|
bleach.ALLOWED_ATTRIBUTES["img"] = ["alt", "src"]
|
||||||
|
bleach.ALLOWED_ATTRIBUTES["*"] = ["class", "style"]
|
||||||
|
|
||||||
|
|
||||||
def _make_extensions_list(wikilinks_config=None, project=None):
|
def _make_extensions_list(wikilinks_config=None, project=None):
|
||||||
|
@ -112,12 +115,12 @@ def _get_markdown(project):
|
||||||
@cache_by_sha
|
@cache_by_sha
|
||||||
def render(project, text):
|
def render(project, text):
|
||||||
md = _get_markdown(project)
|
md = _get_markdown(project)
|
||||||
return bleach.clean(md.convert(text), tags=ALLOWED_TAGS)
|
return bleach.clean(md.convert(text))
|
||||||
|
|
||||||
|
|
||||||
def render_and_extract(project, text):
|
def render_and_extract(project, text):
|
||||||
md = _get_markdown(project)
|
md = _get_markdown(project)
|
||||||
result = bleach.clean(md.convert(text), tags=ALLOWED_TAGS)
|
result = bleach.clean(md.convert(text))
|
||||||
return (result, md.extracted_data)
|
return (result, md.extracted_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue