# Code blocks within details

**URL:** https://meta.discourse.org/t/code-blocks-within-details/51572
**Category:** Support
**Created:** [2016年十月14日 22:04 UTC](https://meta.discourse.org/t/code-blocks-within-details/51572 "2016-10-14T22:04:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Bibliofile](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bibliofile/32/78633_2.png) [@Bibliofile](https://meta.discourse.org/u/Bibliofile)
#### Post date: [2016年十月14日 22:04 UTC](https://meta.discourse.org/t/code-blocks-within-details/51572/1 "2016-10-14T22:04:11Z")

</div>

There is an issue with code blocks within `details` tags. I won’t even try to guess why this is broken. If you put the following code into a post, instead of the two distinct details blocks with code blocks within them that you would expect, you get a single details block with stripped HTML inside

````
<details><summary>Summary</summary>

```HTML
<script>alert("Text");</script>
```
</details>

<details><summary>Summary2</summary>

```HTML
<script>alert("Text"); </script>
```

</details>

````

Example:

> **Summary**
>
> ```HTML
> <script>alert("Text");</script>
> 
> ```

> **Summary2**
>
> ```HTML
> <script>alert("Text"); </script>
> 
> ```

---

<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: [2016年十月14日 22:09 UTC](https://meta.discourse.org/t/code-blocks-within-details/51572/2 "2016-10-14T22:09:56Z")

</div>

The issue isn’t with details tags, it’s with the language you listed for the code block. `HTML` isn’t a valid language. You need to use `html`.

This works:

````plaintext
<details><summary>Summary</summary>

```html
<script>alert("Text");</script>
```
</details>

<details><summary>Summary2</summary>

```html
<script>alert("Text"); </script>
```

</details>
````

> **Summary**
>
> ```html
> <script>alert("Text");</script>
> 
> ```

> **Summary2**
>
> ```html
> <script>alert("Text"); </script>
> 
> ```

---

<div class="post-metadata">

### Author: ![Bibliofile](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bibliofile/32/78633_2.png) [@Bibliofile](https://meta.discourse.org/u/Bibliofile)
#### Post date: [2016年十月14日 22:46 UTC](https://meta.discourse.org/t/code-blocks-within-details/51572/3 "2016-10-14T22:46:57Z")

</div>

Thank you! No wonder I couldn’t seem to reproduce this with any other language…

---

<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: [2016年十月17日 08:28 UTC](https://meta.discourse.org/t/code-blocks-within-details/51572/4 "2016-10-17T08:28:03Z")

</div>


