Support fenced code in package comments

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2017-04-24 17:42:37 +02:00
parent 362ee754e7
commit fd880a7a84

View file

@ -86,9 +86,10 @@ def main():
conn = aurweb.db.Connection() conn = aurweb.db.Connection()
text, pkgbase = get_comment(conn, commentid) text, pkgbase = get_comment(conn, commentid)
html = markdown.markdown(text, extensions=[LinkifyExtension(), html = markdown.markdown(text, extensions=['fenced_code',
LinkifyExtension(),
GitCommitsExtension(pkgbase)]) GitCommitsExtension(pkgbase)])
allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p'] allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p', 'pre']
html = bleach.clean(html, tags=allowed_tags) html = bleach.clean(html, tags=allowed_tags)
save_rendered_comment(conn, commentid, html) save_rendered_comment(conn, commentid, html)