# Line breaks missing from embedded tweets

**URL:** <https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297>\
**Category:** Feature\
**Created:** [July 30, 2014, 9:52pm UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297 "2014-07-30T21:52:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Buddy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/buddy/32/41024_2.png) [@Buddy](https://meta.discourse.org/u/Buddy)\
**Post date:** [July 30, 2014, 9:52pm UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/1 "2014-07-30T21:52:38Z")

</div>

**Expected behaviour:** tweet displays correctly.  
**Current behaviour:** newlines missing  
**Steps to reproduce:** onebox the following tweet, or one like it  
[https://twitter.com/SirEvisiae/status/330541240443604992](https://twitter.com/SirEvisiae/status/330541240443604992)

---

<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:** [July 30, 2014, 9:56pm UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/2 "2014-07-30T21:56:04Z")

</div>

PR welcome on the onebox gem if you want to fix it.

---

<div class="post-metadata">

**Author:** ![Buddy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/buddy/32/41024_2.png) [@Buddy](https://meta.discourse.org/u/Buddy)\
**Post date:** [July 30, 2014, 10:31pm UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/3 "2014-07-30T22:31:45Z")

</div>

> [@Line breaks missing from embedded tweets](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/2):
>
> PR welcome on the onebox gem if you want to fix it.

ok

---

<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:** [August 1, 2014, 1:15am UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/4 "2014-08-01T01:15:48Z")

</div>

This is not a bug, depending on the Twitter client and platform newlines may or may not be visible.

---

<div class="post-metadata">

**Author:** ![Buddy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/buddy/32/41024_2.png) [@Buddy](https://meta.discourse.org/u/Buddy)\
**Post date:** [August 2, 2014, 1:27pm UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/5 "2014-08-02T13:27:20Z")

</div>

> **[X Developer Platform](https://developer.twitter.com/)**
>
> Use the X API with an all-new Developer Console and consumption-based billing. No fixed monthly costs, no monthly caps.

---

<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:** [August 2, 2014, 9:34pm UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/6 "2014-08-02T21:34:51Z")

</div>

> Links in Tweet text must be displayed using the display\_url field in the URL entities API response, and link to the original [t.co](http://t.co) url field. See our [t.co](http://t.co) best practices article for additional details.

This would be way higher priority and help so much more.

---

<div class="post-metadata">

**Author:** ![Buddy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/buddy/32/41024_2.png) [@Buddy](https://meta.discourse.org/u/Buddy)\
**Post date:** [August 3, 2014, 1:57am UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/7 "2014-08-03T01:57:09Z")

</div>

Ok, it seems like this should be doable by getting the html tweet body supplied by twitter and interpolating that directly into the template. Is that correct? I don’t think mustache will allow us to do this except by including raw html.

As for the formatting, it appears twitter uses `white-space: pre-wrap;`, which is usually applied to embedded tweets with a script. The options I can see are:

- `pre` tag
- may break wrapping
- styling
- overriding css could break tweet display
- escape all whitespace
- including exotic unicode space chars?

Alternatively, you might choose to leave the twitter engine styling as-is, and let users enable ‘rich’ oembed type if they want more extensive styling. If I understand correctly, whitelisting is currently done by editing a ruby file; would it be helpful if I were to try and shift that to a configurable option, and allow enabling different oembed or opengraph types on a per-site basis?

---

<div class="post-metadata">

**Author:** ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)\
**Post date:** [January 18, 2018, 9:49pm UTC](https://meta.discourse.org/t/line-breaks-missing-from-embedded-tweets/18297/8 "2018-01-18T21:49:58Z")

</div>


