redcarpet
redcarpet copied to clipboard
Links bounded with angle brackets get doubly linkified
Hello!
When a link is specified with angle brackets around a URL as the link text, the link gets doubly linkified and the real target becomes that of the description, rather than the markdown-specified target.
require 'redcarpet'
renderer = Redcarpet::Render::HTML.new()
markdown = Redcarpet::Markdown.new(renderer, {})
puts markdown.render('[<http://test.com/>](https://google.com)')
<p><a href="https://google.com"><a href="http://test.com/">http://test.com/</a></a></p>
The two nested <a> tags result take the user to test.com when they click on the linked text.
It looks like this is happening because it's autolinking <http://test.com/> after generating the initial link.
Am I correct in assuming this is undesirable behaviour? Let me know if there's anything I can help with!