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

Trailing non-breaking space included in link #73

Open
dukebrown opened this issue Oct 3, 2017 · 1 comment
Open

Trailing non-breaking space included in link #73

dukebrown opened this issue Oct 3, 2017 · 1 comment

Comments

@dukebrown
Copy link

If an input string contains a non-breaking space ( ) immediately after a URL, the non-breaking space and the next word are included in the link.

For example, this string works: http://example.com test. (It becomes <a href="http://example.com/">http://example.com/</a> test.)

However, this string does not work: http://example.com/&nbsp;test. (It becomes <a href="http://example.com/&nbsp;test\">http://example.com/&nbsp;test</a>.)

This also affects strings containing a closing bracket (parenthesis, square bracket, or curly bracket) between the URL and the non-breaking space. For example: website (http://example.com/)&nbsp;of the user becomes website (<a href="http://example.com/)&nbsp;of\">http://example.com/)&nbsp;of</a> the user.

@kivikakk
Copy link
Contributor

kivikakk commented Oct 5, 2017

I can confirm this; we check to see if an entity is at the end of an autolinked URL and remove it accordingly, but if one appears 'within' a candidate we don't detect or notice it. I'm not sure this edge case is enough for us to redo how the delimiter detection works, i.e. to scan within a URL for an entity. We don't and likely will not ever do full entity detection; you might consider using an actual markup language (like Markdown) if you need to be this precise — or insert the non-breaking space directly into the source material, as rinku will work around that. (Worth also keeping in mind that &…; may appear within a real URL.)

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

2 participants