Oneboxing URLs with two dashes

(Daniel Hollas) #1

Ok, here’s a weird bug. When an URL contains --, the markdown converts it do –

For example, this URL:


If I explicitly insert a link, it works, even though it is rendered incorectly:

PS: Hm, linkifying seems to be disabled here on meta, but hopefully the second example makes things clear.

Onebox Twitter embedding failing when URL contains valid Markdown
(Jeff Atwood) #2

Having two dashes in the URL is quite unusual. Do you need to do that? Why doesn’t a single dash suffice?

(Daniel Hollas) #3

Well, I do not know, but I do not control how the URL looks. :slight_smile: I’d say if it is a valid URL, Discourse should handle it correctly, no?

(Sam Saffron) #4

I do think it is a minor bug in linkify / prettify interaction, @Vitaly is this an edge case we should report?

@danekhollas a workaround is to do <> which bypasses all magic.

(Jeff Atwood) #5

That works but also prevents oneboxing.

There is an edge case here where we should onebox


On a line by itself

(Sam Saffron) #6

<> though is already the escape hatch from inline onebox so this would give it double meaning, it is edge case on top of edge case. Tricky problem, not sure there is trivial solution here. prettify though should ideally apply after linkify not before it, we can fix that.

(Jeff Atwood) #7

I guess… the escape from one boxing is also to add a space in front of the URL. I have run into other cases like this on BBS so it is a real problem. I had to use HTML entity escaping to get around it which is even worse.

(Sam Saffron) #8

Sorry, I mean for example: will become Awesome pictures | 89 best free wallpaper, cloud, sea, and animal photos on Unsplash so the escape hatch is: <> if you need it or a raw link without inline onebox.

So that means we turn <> into

  1. opt-in to onebox by force
  2. opt-out of inline onebox by force

It kind of has a double meaning, since it is mega ninja territory I guess we can live with it.

I am ok to make this change I guess.

This also raises the question of how do we “force opt-in” an inline onebox which I guess mean punycode url for now.

(Jeff Atwood) #9

I am only referring to full size one boxes

See Onebox all the links! - meta - Boing Boing BBS