diff --git a/freepost/__init__.py b/freepost/__init__.py index 3431014..a0bd7a5 100644 --- a/freepost/__init__.py +++ b/freepost/__init__.py @@ -37,8 +37,8 @@ template = functools.partial ( # TODO this should be renamed. It's only a way to pretty print dates 'title': lambda date: dateutil.parser.parse(date).strftime('%b %-d, %Y - %H:%M%z%Z'), # Convert markdown to plain text - 'md2txt': lambda text: bleach.clean (markdown.markdown (text), - tags=[], attributes={}, styles=[], strip=True), + 'md2txt': lambda text: bleach.clean (markdown.markdown(text), + tags=[], attributes={}, strip=True), # Convert markdown to html 'md2html': lambda text: bleach.clean (bleach.linkify (markdown.markdown ( text, @@ -66,7 +66,8 @@ template = functools.partial ( # "bleach" library is used to sanitize the HTML output of jinja2's "md2html" # filter. The library has only a very restrictive list of white-listed # tags, so we add some more here. -bleach.sanitizer.ALLOWED_TAGS += [ 'br', 'img', 'p', 'pre', 'h1', 'h2', 'h3', 'hr' ] +# The list() casting is required because it's of type "frozenlist" +bleach.sanitizer.ALLOWED_TAGS = list(bleach.sanitizer.ALLOWED_TAGS) + [ 'br', 'img', 'p', 'pre', 'h1', 'h2', 'h3', 'hr' ] bleach.sanitizer.ALLOWED_ATTRIBUTES.update ({ 'img': [ 'src' ] })