redcarpet
redcarpet copied to clipboard
Email addresses containing underscore and surrounded by <> are filtered out when filter_html is enabled
A Redmine user reported that Markdown doesn't recognize some email addresses.
I've added two test cases to illustrate the reported problem. Unfortunately, I don't have the required skills to fix the issue.
def test_filter_html_doesnt_filter_email_addresses_surrounded_by_tags
markdown = "<[email protected]>"
output = render(markdown, with: [:filter_html, :autolink])
assert_equal "<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", output
end
def test_filter_html_doesnt_filter_email_addresses_surrounded_by_tags_and_containing_underscore
markdown = "<[email protected]>"
output = render(markdown, with: [:filter_html, :no_intra_emphasis, :autolink])
assert_equal "<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", output
end
The second test fails because [email protected] is considered somehow an HTML tag and it is filtered out.
/vagrant/redcarpet/test/html_render_test.rb:54:in `test_filter_html_doesnt_filter_email_addresses_surrounded_by_tags_and_containing_underscore'
51: markdown = "<[email protected]>"
52: output = render(markdown, with: [:filter_html, :no_intra_emphasis, :autolink])
53:
=> 54: assert_equal "<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", output
55: end
56:
57: def test_that_no_image_flag_works
<"<p><a href=\"mailto:[email protected]\">[email protected]</a></p>"> expected but was
<"">
Failure: test_filter_html_doesnt_filter_email_addresses_surrounded_by_tags_and_containing_underscore(HTMLRenderTest)
..........................
Finished in 0.30313018 seconds.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
131 tests, 190 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
99.2366% passed