Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pure link feature does not support inline links without a protocol #487

Open
ronaldwind opened this issue Feb 21, 2024 · 3 comments
Open
Assignees

Comments

@ronaldwind
Copy 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:

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.

@flurin
Copy link

flurin commented Mar 18, 2024

Any news on this?

@amit-chaudhari1 amit-chaudhari1 self-assigned this Mar 21, 2024
@amit-chaudhari1
Copy link
Collaborator

Sorry for the delay, had minor health issues.

The quick workaround here would be very straight forward, but I'm working on implementing something that would work for the most common links like mailto: ftp, IPV4 and IPV6, along with the example they gave

Shall commit a fix over the weekend.

@cometeer
Copy link

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants