dwitter icon indicating copy to clipboard operation
dwitter copied to clipboard

Bug in link rendering

Open iver56 opened this issue 8 years ago • 9 comments

https://www.dwitter.net/d/435

That rendered comment looks buggy. I think the original comment just had a link there

bilde

iver56 avatar Apr 22 '18 16:04 iver56

Oh that's kinda nasty. Guess we have to make sure that any hashtag is not part of a valid URL... Hmm.

lionleaf avatar Apr 22 '18 16:04 lionleaf

Another: https://www.dwitter.net/d/477

stianjensen avatar Apr 29 '18 09:04 stianjensen

How about requiring a word boundary before the #? That is \<# in some regexp syntaxes, \b# in others.

Doing that would ignore the following:

abc#def
https://foo.com/bar#baz

But it would still match the following (good or bad, hard to say!):

https://foo.com/bar.#baz

Or if you also wanted to ignore the latter, you could get more strict: require a blank space before the hashtag (or start of string). That would be (^|\s)# in some regexp syntaxes.

That would not even match this:

file this under:#banana

joeytwiddle avatar Apr 29 '18 10:04 joeytwiddle

This only happens when a valid hashtag is in a substring of a valid link or &symbol; right? Should be doable to test if that's the case and then not expand it. I think we will get quite a bit of dead hashtags if the rules are too strict. People usually #chain#hashtags#for#instance?#maybe .

Editing of comments or highlighting of hashtags as you type would obviously help here, but still.

Furthermore, this would allow us to bring back hashtags starting with numbers, as there are some useful ones I wish worked: #3D #404 for instance.

lionleaf avatar Apr 29 '18 13:04 lionleaf

Do other platforms allow hashtags that are not preceded by a space?

stianjensen avatar Apr 29 '18 14:04 stianjensen

Looks like it's fairly common to require a space or a special character before a hashtag, but varies per platform. Autocomplete and highlights as you write would solve this no matter which way we go. I guess a preceding space would make life easier, but slightly frustrating for users in some cases!#like_this

lionleaf avatar Apr 29 '18 14:04 lionleaf

Another arguably false positive for hashtags: https://www.dwitter.net/d/1486

Thanks to fujimotos from discord

lionleaf avatar Apr 29 '18 14:04 lionleaf

Yeah, I just ran into another scenario where a hex color code inside a code snippet was hyperlinked as a tag: "#362":"#bb3"

https://www.dwitter.net/d/9083

atesgoral avatar Aug 05 '18 00:08 atesgoral

Here's another example from @yonatan: https://www.dwitter.net/d/2667

@dwitterer has started looking at regex solutions.

lionleaf avatar Oct 26 '18 01:10 lionleaf