# \[details\] breaks when embedded in a paragraph

**URL:** https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259
**Category:** Feature
**Created:** [5월 24, 2017, 3:34오전 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259 "2017-05-24T03:34:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![okeefe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/okeefe/32/72699_2.png) [@okeefe](https://meta.discourse.org/u/okeefe)
#### Post date: [5월 24, 2017, 3:34오전 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/1 "2017-05-24T03:34:15Z")

</div>

In Discourse 1.8.0.beta13, the [details=Spoiler]This should be hidden[details] logic doesn’t work if it’s embedded in a paragraph. It does work if it’s separated by a newline. The problem appears to be in the generated html, as it’s reproducible in Chrome, Firefox, and Safari.

* * *

> **details tag with proceeding newline**
>
> This text is hidden until you click the text.

* * *

Here’s an embedded [details=details tag embedded]This text shows up all the time in the page, but _the preview makes it looks like it works_.[/details] paragraph.

---

<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: [5월 24, 2017, 4:06오전 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/2 "2017-05-24T04:06:15Z")

</div>

Not really a bug, we expect newlines there.

---

<div class="post-metadata">

### Author: ![okeefe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/okeefe/32/72699_2.png) [@okeefe](https://meta.discourse.org/u/okeefe)
#### Post date: [5월 24, 2017, 4:24오전 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/3 "2017-05-24T04:24:40Z")

</div>

Expecting newlines might be the bug.

Why does the preview have the expected behavior, then? One would expect that and the rendered version to act the same.

Using [details] for spoilers and not knowing this buggy behavior means you think you left a properly hidden spoiler when in fact you didn’t. This has been super aggravating, confusing, and unexpected for myself and friends on another discourse instance.

---

<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: [5월 24, 2017, 4:29오전 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/4 "2017-05-24T04:29:23Z")

</div>

Details is by definition a block level element. If you want inline, use the other style which is called .. wait for it.. SPOILER.

It works kinda like this you see.

`It works [spoiler]kinda like this[/spoiler] you see.`

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5월 24, 2017, 6:06오전 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/5 "2017-05-24T06:06:23Z")

</div>

> [@okeefe](#):
>
> Why does the preview have the expected behavior, then? One would expect that and the rendered version to act the same.

I think this is a real bug here. The `[details]` tag renders differently in preview than in the cooked post. I’ve experienced it myself. I’ve also had to try and explain to my users why something looks OK in preview but fails once posted.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [5월 24, 2017, 7:28오전 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/6 "2017-05-24T07:28:41Z")

</div>

Yeah, the preview not being consistent with the final cooked post is annoying. Will fix.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [8월 20, 2018, 2:38오후 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/8 "2018-08-20T14:38:37Z")

</div>

Preview is now consistent with the cooked post (none of them support being “embedded” in a paragraph).

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [8월 20, 2018, 2:38오후 UTC](https://meta.discourse.org/t/details-breaks-when-embedded-in-a-paragraph/63259/9 "2018-08-20T14:38:39Z")

</div>


