Oneboxing URLs with two dashes

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

For example, this URL: cs--preview.khanacademy.org

If I explicitly insert a link, it works, even though it is rendered incorectly:
[https://cs--preview.khanacademy.org](https://cs--preview.khanacademy.org)
https://cs–preview.khanacademy.org

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

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

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?

2개의 좋아요

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 <https://cs--preview.khanacademy.org> https://cs--preview.khanacademy.org which bypasses all magic.

4개의 좋아요

That works but also prevents oneboxing.

There is an edge case here where we should onebox

<https://example.com>

On a line by itself

<> 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.

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.

Sorry, I mean for example: https://unsplash.com/collections/411759/awesome-pictures will become https://unsplash.com/collections/411759/awesome-pictures so the escape hatch is: <https://unsplash.com/collections/411759/awesome-pictures> 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.

I am only referring to full size one boxes

See Onebox all the links! - #99 by Wanderfound - meta - Boing Boing BBS

1개의 좋아요

아마도 “두 대시” 문제는 linkifier에서 해결되었고(linkify-it/CHANGELOG.md at master · markdown-it/linkify-it · GitHub), markdown-it에도 자동으로 반영된 것 같습니다.

따라서 의존성이 업그레이드된 후 discourse에도 수정 사항이 적용되었습니다. 증거:

test http://cs--preview.khanacademy.org test

이것은 해결된 것으로 표시해도 될 것 같습니다. 이 유형의 링크에 대해 더 이상 <...> 범위가 필요하지 않습니다.

3개의 좋아요