Skip to content

Commit

Permalink
Revert "render_markdown breaks links with ampersands"
Browse files Browse the repository at this point in the history
This reverts commit 52eaef8.
  • Loading branch information
amercader committed Feb 22, 2017
1 parent 97bf46e commit c2717e6
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions ckan/lib/helpers.py
Expand Up @@ -24,8 +24,6 @@
from webhelpers import paginate
from webhelpers.text import truncate
import webhelpers.date as date
from markdown import markdown
from bleach import clean as clean_html, ALLOWED_TAGS
from pylons import url as _pylons_default_url
from pylons.decorators.cache import beaker_cache
from pylons import config
Expand All @@ -44,14 +42,6 @@
import ckan.lib.uploader as uploader
import ckan.authz as authz


MARKDOWN_TAGS = set([
'del', 'dd', 'dl', 'dt', 'h1', 'h2',
'h3', 'img', 'kbd', 'p', 'pre', 's',
'sup', 'sub', 'strike', 'br', 'hr'
]).union(ALLOWED_TAGS)


from ckan.common import (
_, ungettext, g, c, request, session, json, OrderedDict
)
Expand Down Expand Up @@ -126,7 +116,7 @@ def get_site_protocol_and_host():
If `ckan.site_url` is set like this::
ckan.site_url = http://example.com
Then this function would return a tuple `('http', 'example.com')`
If the setting is missing, `(None, None)` is returned instead.
Expand Down Expand Up @@ -1699,7 +1689,7 @@ def render_markdown(data, auto_link=True, allow_html=False):
data = markdown(data.strip(), safe_mode=False)
else:
data = RE_MD_HTML_TAGS.sub('', data.strip())
data = clean_html(markdown(data), strip=True, tags=MARKDOWN_TAGS)
data = markdown(data, safe_mode=True)
# tags can be added by tag:... or tag:"...." and a link will be made
# from it
if auto_link:
Expand Down

0 comments on commit c2717e6

Please sign in to comment.