Welcome to Codidact Meta!
Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.
Details tag requires an internal blank line to render markdown
When using a <details>
tag to add an expandable section to a post, markdown will mostly still work inside the expandable section, but some of it will not work on the first line. Markdown treats multiple lines as a single line for rendering unless separated by a blank line or a trailing pair of spaces. This means that the failure to render can happen even if there is apparently no markdown syntax in the first line, which can exacerbate the confusion.
This can be worked around by the user by adding an initial blank line inside the <details>
tag. Could this be automated, so that every <details>
tag has an initial blank line added before the markdown is processed? Adding initial blank lines inside the <details>
tag has no other effect, as the blank lines are ignored when rendering markdown:
<details><summary>Example with many initial blank lines</summary>
Example wording.
</details>
renders without the initial blank lines:
Example with many initial blank lines
Example wording.
Examples of broken markdown with and without the workaround
Code blocks with triple back ticks
<details><summary>Without an initial blank line</summary>
Word
```
code
```
</details>
renders as:
Without an initial blank line
Word ``` code ```<details><summary>With an initial blank line</summary>
Word
```
code
```
</details>
renders as:
With an initial blank line
Word
code
Headings
<details><summary>Without an initial blank line</summary>
Word
###### Heading
Word
</details>
renders as:
Without an initial blank line
Word ###### Heading Word<details><summary>With an initial blank line</summary>
Word
###### Heading
Word
</details>
renders as:
With an initial blank line
Word
Heading
Word
Inline code
<details><summary>Without an initial blank line</summary>
A sentence with `code` in it.
</details>
renders as:
Without an initial blank line
A sentence with `code` in it.<details><summary>With an initial blank line</summary>
A sentence with `code` in it.
</details>
renders as:
With an initial blank line
A sentence with code
in it.
Bullet points (unordered lists)
<details><summary>Without an initial blank line</summary>
- one
- two
- three
</details>
renders as:
Without an initial blank line
- one - two - three<details><summary>With an initial blank line</summary>
- one
- two
- three
</details>
renders as:
With an initial blank line
- one
- two
- three
Numbered lists (ordered lists)
<details><summary>Without an initial blank line</summary>
1. one
1. two
1. three
</details>
renders as:
Without an initial blank line
1. one 1. two 1. three<details><summary>With an initial blank line</summary>
1. one
1. two
1. three
</details>
renders as:
With an initial blank line
- one
- two
- three
Quote blocks
<details><summary>Without an initial blank line</summary>
> one
>
> two
>
> three
</details>
renders as:
Without an initial blank line
> one > > two > > three<details><summary>With an initial blank line</summary>
> one
>
> two
>
> three
</details>
renders as:
With an initial blank line
one
two
three
Bold and italics
<details><summary>Without an initial blank line</summary>
It was a *dark* **stormy** night ***long*** ago
</details>
renders as:
Without an initial blank line
It was a *dark* **stormy** night ***long*** ago<details><summary>With an initial blank line</summary>
It was a *dark* **stormy** night ***long*** ago
</details>
renders as:
With an initial blank line
It was a dark stormy night long ago
1 answer
[status-bydesign]
In so far as there is a Markdown spec, this is part of it: you can't mix HTML and Markdown. If you're formatting using HTML tags, Markdown parsers will generally ignore Markdown in the same block (might only apply to block-level Markdown - can't remember off the top of my head). The blank line is required to "reset" out of HTML mode so you can use Markdown again.
0 comment threads