Skip to content

Commit

Permalink
allow xmpp: URLs in Markdown, closes #500
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Jan 9, 2017
1 parent e5fa11b commit 7356f71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion liberapay/utils/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import misaka as m # http://misaka.61924.nl/


url_re = re.compile(r'^https?:')
url_re = re.compile(r'^(https?|xmpp):')


class CustomRenderer(m.HtmlRenderer):
Expand Down
6 changes: 6 additions & 0 deletions tests/py/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ def test_markdown_render_renders_https_links(self):
expected = '<p><a href="https://example.com/">https://example.com/</a></p>\n'
assert markdown.render('<https://example.com/>') == expected

def test_markdown_render_renders_xmpp_links(self):
expected = '<p><a href="xmpp:[email protected]">foo</a></p>\n'
assert markdown.render('[foo](xmpp:[email protected])') == expected
expected = '<p><a href="xmpp:[email protected]">xmpp:[email protected]</a></p>\n'
assert markdown.render('<xmpp:[email protected]>') == expected

def test_markdown_render_escapes_javascript_links(self):
expected = '<p>[foo](javascript:foo)</p>\n'
assert markdown.render('[foo](javascript:foo)') == expected
Expand Down

0 comments on commit 7356f71

Please sign in to comment.