The pure link converter does not seem to autolink URLs without a prefixed protocol.
I would expect the following four examples to all result in a link:
visit https://github.com
https://github.com
www.github.com
visit www.github.com
However, the last one is not automatically linked:
iex> Earmark.as_html("visit https://github.com")
{:ok, "<p>\nvisit <a href=\"https://github.com\">https://github.com</a></p>\n", []}
iex> Earmark.as_html("https://github.com")
{:ok, "<p>\n<a href=\"https://github.com\">https://github.com</a></p>\n", []}
iex> Earmark.as_html("www.github.com")
{:ok, "<p>\n<a href=\"http://www.github.com\">www.github.com</a></p>\n", []}
iex> Earmark.as_html("visit www.github.com")
{:ok, "<p>\nvisit www.github.com</p>\n", []}
As far as I can tell the last link is not detected by
|
text: ~r{^[\s\S]+?(?=~~|[\\<!\[_*`#{subsup}]|https?://| \{2,\}\n|$)} |
which results in the PureLinkHelpers not converting it into a link.
The pure link converter does not seem to autolink URLs without a prefixed protocol.
I would expect the following four examples to all result in a link:
However, the last one is not automatically linked:
As far as I can tell the last link is not detected by
earmark/lib/earmark_parser/context.ex
Line 116 in 39a2045