# Links containing underscores don't get oneboxed

**URL:** https://meta.discourse.org/t/links-containing-underscores-dont-get-oneboxed/80309
**Category:** Feature
**Tags:** markdown
**Created:** [February 11, 2018, 3:32pm UTC](https://meta.discourse.org/t/links-containing-underscores-dont-get-oneboxed/80309 "2018-02-11T15:32:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![imagejan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/imagejan/32/119672_2.png) [@imagejan](https://meta.discourse.org/u/imagejan)
#### Post date: [February 11, 2018, 3:32pm UTC](https://meta.discourse.org/t/links-containing-underscores-dont-get-oneboxed/80309/1 "2018-02-11T15:32:15Z")

</div>

I noticed that links containing underscores (`_`) don’t get oneboxed correctly under certain conditions, because the underscores get interpreted as formatting directives.

Consider this link:

```plaintext
https://github.com/arve0/fijibin/blob/a3d2e983cb9ff2bcbb56a800084bc3b35cb9292f/fijibin/ __init__.py#L23

```

Trying to onebox:

> <https://github.com/arve0/fijibin/blob/a3d2e983cb9ff2bcbb56a800084bc3b35cb9292f/fijibin/ __init__.py#L23>

This can be worked around using `%5F` to replace the first underscore:

```plaintext
https://github.com/arve0/fijibin/blob/a3d2e983cb9ff2bcbb56a800084bc3b35cb9292f/fijibin/%5F_init__.py#L23

```

> <https://github.com/arve0/fijibin/blob/a3d2e983cb9ff2bcbb56a800084bc3b35cb9292f/fijibin/%5F_init__.py#L23>

---

<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: [February 11, 2018, 7:01pm UTC](https://meta.discourse.org/t/links-containing-underscores-dont-get-oneboxed/80309/2 "2018-02-11T19:01:59Z")

</div>

simply put brackets around it like so

`<https://github.com/arve0/fijibin/blob/a3d2e983cb9ff2bcbb56a800084bc3b35cb9292f/fijibin/ __init__.py#L23>`

Not a bug, auto linking cannot be expected to work in all scenarios. See [http://commonmark.org/help](http://commonmark.org/help) for the markdown spec on this

---

<div class="post-metadata">

### Author: ![notriddle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/notriddle/32/133055_2.png) [@notriddle](https://meta.discourse.org/u/notriddle)
#### Post date: [February 11, 2018, 8:52pm UTC](https://meta.discourse.org/t/links-containing-underscores-dont-get-oneboxed/80309/3 "2018-02-11T20:52:23Z")

</div>

That doesn’t get oneboxed, either (the percent encoding method seems like the right way to work around this).

---

<div class="post-metadata">

### Author: ![imagejan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/imagejan/32/119672_2.png) [@imagejan](https://meta.discourse.org/u/imagejan)
#### Post date: [February 12, 2018, 4:34pm UTC](https://meta.discourse.org/t/links-containing-underscores-dont-get-oneboxed/80309/4 "2018-02-12T16:34:12Z")

</div>

> [@codinghorror](#):
>
> simply put brackets around it like so

I agree with @notriddle: adding the brackets (`<>`) will keep the link intact, but actually _prevents_ oneboxing in my trials.

---

<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: [February 13, 2018, 6:11am UTC](https://meta.discourse.org/t/links-containing-underscores-dont-get-oneboxed/80309/5 "2018-02-13T06:11:10Z")

</div>

> [@imagejan](#):
>
> but actually prevents oneboxing in my trials

I am half open to allowing oneboxing (but not mini oneboxing) it is quite an edge case though. The bug is in linkify: [GitHub - markdown-it/linkify-it: Links recognition library with full unicode support · GitHub](https://github.com/markdown-it/linkify-it) so may be worth mentioning in an issue there.
