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

Do not autolink a trailing "!" in a URL #638

Closed
wants to merge 1 commit into from

Conversation

bantic
Copy link
Contributor

@bantic bantic commented Aug 7, 2015

I noticed in another project that uses marked that the text "http://localtunnel.me!" was being turned into a link that incorrectly included the trailing "!".

This PR changes the gfm url regex to explicitly not include a trailing "!".

It also expands the tests for gfm links to test for all the possible ending punctuation that the regex doesn't capture as part of the link as well as a test for no trailing punctuation.

I wasn't sure what the correct behavior is for determining whether a character is part of a link or punctuation. The exclamation point is technically a valid character to use in a url, but so are the closing parens (")") and single and double quote marks, which are also part of the existing url regex. It seems far more likely that a sentence written in markdown would end with a url followed by a "!" than that a url would end with a "!", though.

For reference, Rinku, the link-detecting library used by github's markdown gem, allows "?", "!", ".", "," and ":" as trailing punctuation.

  * Expand gfm link tests to include all possible ending punctuation
@joshbruce
Copy link
Member

Closing as stale and merge conflicts. Created issue to keep it on our radar. Please resubmit based on latest, if still a problem and defined in one of the specifications being targeted - see #956

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

Successfully merging this pull request may close these issues.

2 participants