# Oneboxing URLs with two dashes

**URL:** https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568
**Category:** Bug
**Created:** [April 4, 2018, 1:29pm UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568 "2018-04-04T13:29:52Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [April 4, 2018, 1:29pm UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/1 "2018-04-04T13:29:52Z")

</div>

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

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

> **[Client Challenge](https://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](https://cs--preview.khanacademy.org)

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 4, 2018, 5:28pm UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/2 "2018-04-04T17:28:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [April 4, 2018, 6:02pm UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/3 "2018-04-04T18:02:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 5, 2018, 1:08am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/4 "2018-04-05T01:08:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 5, 2018, 1:10am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/5 "2018-04-05T01:10:33Z")

</div>

That works but also prevents oneboxing.

There is an edge case here where we should onebox

`<https://example.com>`

On a line by itself

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 5, 2018, 1:14am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/6 "2018-04-05T01:14:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 5, 2018, 1:16am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/7 "2018-04-05T01:16:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 5, 2018, 1:20am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/8 "2018-04-05T01:20:50Z")

</div>

Sorry, I mean for example: `https://unsplash.com/collections/411759/awesome-pictures` will become [https://unsplash.com/collections/411759/awesome-pictures](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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 5, 2018, 1:56am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/9 "2018-04-05T01:56:59Z")

</div>

I am only referring to full size one boxes

See [Onebox all the links! - #99 by Wanderfound - meta - Boing Boing BBS](https://bbs.boingboing.net/t/onebox-all-the-links/88082/99?u=codinghorror)

---

<div class="post-metadata">

### Author: ![Vitaly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vitaly/32/120475_2.png) [@Vitaly](https://meta.discourse.org/u/Vitaly)
#### Post date: [January 7, 2022, 11:13am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/10 "2022-01-07T11:13:13Z")

</div>

I guess, “two-dashes” issue was solved in linkifier [linkify-it/CHANGELOG.md at master · markdown-it/linkify-it · GitHub](https://github.com/markdown-it/linkify-it/blob/master/CHANGELOG.md#210--2018-11-27), and auto-propagated to `markdown-it`.

So, fix was landed to discourse after dependencies uprgade. Proof:

> test [http://cs--preview.khanacademy.org](http://cs--preview.khanacademy.org) test

I think, this can be marked as solved. No more `<...>` scopes required for this kind of links.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 11, 2022, 5:24am UTC](https://meta.discourse.org/t/oneboxing-urls-with-two-dashes/84568/11 "2022-01-11T05:24:33Z")

</div>


