# GitHub onebox wrongly removes identation inside the curly braces

**URL:** <https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178>\
**Category:** Bug\
**Created:** [April 25, 2016, 1:23pm UTC](https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178 "2016-04-25T13:23:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmitry\_fedyuk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_fedyuk/32/293153_2.png) [@dmitry\_fedyuk](https://meta.discourse.org/u/dmitry_fedyuk)\
**Post date:** [April 25, 2016, 1:23pm UTC](https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178/1 "2016-04-25T13:23:04Z")

</div>

An example of the wrong rendering:

> <https://github.com/magento/magento2/blob/958164/lib/internal/Magento/Framework/EntityManager/EntityHydratorInterface.php#L12-L30>

The right rendering (you can see it directly on GitHub using the link above):

 ![](https://global.discourse-cdn.com/meta/original/3X/0/4/047622cb3d5b78c5ef3038eef2962924aed6fae6.png)

---

<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 25, 2016, 6:46pm UTC](https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178/2 "2016-04-25T18:46:38Z")

</div>

Seems correct to me, I do not want to see out of context indentation for snippets anyway. What if it was indented 50 spaces because it is a deeply nested routine?

---

<div class="post-metadata">

**Author:** ![dmitry\_fedyuk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_fedyuk/32/293153_2.png) [@dmitry\_fedyuk](https://meta.discourse.org/u/dmitry_fedyuk)\
**Post date:** [April 25, 2016, 8:00pm UTC](https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178/3 "2016-04-25T20:00:06Z")

</div>

It is IN-context identation, because the context is set by the curly braces.

---

<div class="post-metadata">

**Author:** ![dmitry\_fedyuk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_fedyuk/32/293153_2.png) [@dmitry\_fedyuk](https://meta.discourse.org/u/dmitry_fedyuk)\
**Post date:** [April 26, 2016, 10:50am UTC](https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178/4 "2016-04-26T10:50:58Z")

</div>

Another example (JavaScript code):

> <https://github.com/magento/magento2/blob/958164/app/code/Magento/Shipping/view/adminhtml/templates/create/items.phtml#L147-L166>

The contents of the `window.submitShipment` function is idented in the original code (you can see it on GitHub using the link above), but the onebox removes this identation for a some reason.

---

<div class="post-metadata">

**Author:** ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)\
**Post date:** [March 7, 2019, 12:53pm UTC](https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178/5 "2019-03-07T12:53:36Z")

</div>

Fixed via:

[https://github.com/discourse/onebox/commit/13af35fcc321ebdfac557ee3caaaf257800fdd69](https://github.com/discourse/onebox/commit/13af35fcc321ebdfac557ee3caaaf257800fdd69)

* * *

Example:

> <https://github.com/magento/magento2/blob/958164/lib/internal/Magento/Framework/EntityManager/EntityHydratorInterface.php#L12-L30>

---

<div class="post-metadata">

**Author:** ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)\
**Post date:** [March 7, 2019, 12:53pm UTC](https://meta.discourse.org/t/github-onebox-wrongly-removes-identation-inside-the-curly-braces/43178/6 "2019-03-07T12:53:40Z")

</div>


