summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--apioforum/mdrender.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/apioforum/mdrender.py b/apioforum/mdrender.py
index 1df104f..5f5292d 100644
--- a/apioforum/mdrender.py
+++ b/apioforum/mdrender.py
@@ -10,14 +10,21 @@ allowed_tags = [
'h6',
'pre',
'del',
- 'mark'
+ 'mark',
+ 'img',
]
+
+allowed_attributes = bleach.sanitizer.ALLOWED_ATTRIBUTES.copy()
+allowed_attributes.update(
+ img='src',
+)
+
allowed_tags.extend(bleach.sanitizer.ALLOWED_TAGS)
-cleaner = bleach.sanitizer.Cleaner(tags=allowed_tags)
+cleaner = bleach.sanitizer.Cleaner(tags=allowed_tags,attributes=allowed_attributes)
import markdown
-md = markdown.Markdown(extensions=['pymdownx.tilde'])
+md = markdown.Markdown(extensions=['pymdownx.tilde','fenced_code'])
def render(text):
text = md.reset().convert(text)