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

simplifiedAutoLink should exclude trailing punctuation #308

Closed
smblott-github opened this issue Dec 1, 2016 · 3 comments
Closed

simplifiedAutoLink should exclude trailing punctuation #308

smblott-github opened this issue Dec 1, 2016 · 3 comments
Assignees

Comments

@smblott-github
Copy link

If the input is:

Check out this cool site: https://github.com/showdownjs/showdown.

... then the trailing full stop should be excluded from the link. (This is how GMail, etc, works.)

Would it be safe to skip all trailing punctuation marks?

@tivie
Copy link
Member

tivie commented Dec 1, 2016

That is a tricky one.

Hostnames without a trailing dot are potentially ambiguous. A trailing dot means that the hostname is fully qualified and may not be relative to the local search domain.

See this stackexchange link for a funny example.

Also, a URI can have a dot at the end of the "path"portion. For instance, https://en.wikipedia.org/wiki/Washington,_D.C.

This means you can't safely assume that the final dot is not part of the URL.

However, you rarely need to use fully qualified domains. Only in very specific situations where a URL might be ambiguous. Also, URLs with trailing period are very rare.

@tivie tivie self-assigned this Dec 1, 2016
@tivie tivie added the question label Dec 1, 2016
@tivie
Copy link
Member

tivie commented Dec 1, 2016

So I really don't know if we should go for practicality or correctness.

The practicality argument is that you rarely need periods at the end of the url and in most cases the period marks the end of the sentence.

The correctness argument is that you can't safely assume the period isn't needed at the end of the URL.

There's also the compatibility argument, since showdown as a GitHub flavor, which tries to follow GFM as much as possible, so I think the compromise would be to create an option that treats URLs as GitHub does (in which trailing punctuation marks are left outside the URL), see #266

Also, there's an interesting discussion at http://ux.stackexchange.com/questions/15226/should-a-sentence-ending-with-a-url-terminate-with-a-period

tivie added a commit that referenced this issue Dec 1, 2016
@tivie
Copy link
Member

tivie commented Dec 1, 2016

This was added as a new option called excludeTrailingPunctuationFromURLs. Enabling this will remove trailing punctuation and parenthesis from URL parsing in auto linking.

@tivie tivie closed this as completed Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants