HTML <details> require an empty line before markdown blocks

It’d be nice if Markdown’s “block” syntaxes could work inside <details> without requiring an empty line. I frequently run into this with code segments. For example, this fairly straight-forward syntax is doesn’t render as I’d expect:

<details>
```
# not code
```
</details>

``` # not code ```

While I most commonly hit this with code blocks (given that we run a programming language forum), it’s true of other markdown “block” syntaxes:

For example, headers # are not headers

This is the code for this block:

<details><summary>For example, headers</summary>
# are not headers

This is the code for this block:
```md
(stack overflow)
```
</details>
And same for block quotes > this should be a quote, I'd expect

Is this expected?

2 Likes

Maybe try it like this

[details="open"]

Not code

[/Details]
not code block
Not code

And using the Square brackets.

Headers

Header 1

Header 3

[details="not code block"]
# Header 1
## Header 3
[/Details]
2 Likes

Yeah, this is not a bug, this is the common mark spec

When mixing and matching HTML and markdown you need an extra newline.

This monster works with no newlines, but I would recommend just using the BBCode that @Heliosurge suggested.

<details>
<pre>
<code># yes code
</pre>
</code>
</details>
5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.