feat: Allow <del> and <details/summary> tags in comments

* Allow additional html tags: <del> and <details/summary>
* Convert markdown double-tilde (~~) to <del> tags

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-11-19 19:46:14 +01:00
parent 029ce3b418
commit 765f989b7d
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
2 changed files with 25 additions and 0 deletions

View file

@ -105,6 +105,13 @@ def test_markdown_conversion(user: User, pkgbase: PackageBase):
assert comment.RenderedComment == expected
def test_markdown_strikethrough(user: User, pkgbase: PackageBase):
text = "*~~Hello~~world*~~!~~"
comment = create_comment(user, pkgbase, text)
expected = "<p><em><del>Hello</del>world</em><del>!</del></p>"
assert comment.RenderedComment == expected
def test_html_sanitization(user: User, pkgbase: PackageBase):
text = '<script>alert("XSS!")</script>'
comment = create_comment(user, pkgbase, text)