Code blocks within details


(Bibliofile) #1

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
<script>alert("Text");</script>
Summary2
<script>alert("Text"); </script>

(Joshua Rosenfeld) #2

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:

<details><summary>Summary</summary>

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

<details><summary>Summary2</summary>

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

</details>
Summary
<script>alert("Text");</script>
Summary2
<script>alert("Text"); </script>

(Bibliofile) #3

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


(Régis Hanol) #4