mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add Markdown support to package comments
Support Markdown syntax in package comments. Among other things, this makes it easier to paste command line output and patches. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
016b40f99d
commit
9aa4203c7e
2 changed files with 7 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
import sys
|
||||
import bleach
|
||||
import markdown
|
||||
|
||||
import aurweb.db
|
||||
|
||||
|
@ -22,9 +23,10 @@ def main():
|
|||
|
||||
conn = aurweb.db.Connection()
|
||||
|
||||
html = get_comment(conn, commentid)
|
||||
html = html.replace('\n', '<br>')
|
||||
html = bleach.clean(html, tags=['br'])
|
||||
text = get_comment(conn, commentid)
|
||||
html = markdown.markdown(text, extensions=['nl2br'])
|
||||
allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p', 'br']
|
||||
html = bleach.clean(html, tags=allowed_tags)
|
||||
save_rendered_comment(conn, commentid, html)
|
||||
|
||||
conn.commit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue