[aur-dev] [PATCH 2/2] Support fenced code in package comments

Lukas Fleischer lfleischer at archlinux.org
Mon Apr 24 15:59:23 UTC 2017


Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 aurweb/scripts/rendercomment.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/aurweb/scripts/rendercomment.py b/aurweb/scripts/rendercomment.py
index c23ef8d..f32c827 100755
--- a/aurweb/scripts/rendercomment.py
+++ b/aurweb/scripts/rendercomment.py
@@ -86,9 +86,10 @@ def main():
     conn = aurweb.db.Connection()
 
     text, pkgbase = get_comment(conn, commentid)
-    html = markdown.markdown(text, extensions=[LinkifyExtension(),
+    html = markdown.markdown(text, extensions=['fenced_code',
+                                               LinkifyExtension(),
                                                GitCommitsExtension(pkgbase)])
-    allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p']
+    allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p', 'pre']
     html = bleach.clean(html, tags=allowed_tags)
     save_rendered_comment(conn, commentid, html)
 
-- 
2.12.2


More information about the aur-dev mailing list