Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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.

Post History

60%
+1 −0
Q&A 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 trea...

1 answer  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by ArtOfCode‭

#2: Post edited by user avatar ArtOfCode‭ · 2022-10-19T15:04:52Z (over 1 year ago)
#1: Initial revision by user avatar trichoplax‭ · 2022-10-19T04:13:52Z (over 1 year ago)
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:

```text
<details><summary>Example with many initial blank lines</summary>




Example wording.
</details>
```

renders without the initial blank lines:

<details><summary>Example with many initial blank lines</summary>




Example wording.
</details>

# Examples of broken markdown with and without the workaround

## Code blocks with triple back ticks
````text
<details><summary>Without an initial blank line</summary>
Word
```
code
```
</details>
````

renders as:

<details><summary>Without an initial blank line</summary>
Word
```
code
```
</details>

````text
<details><summary>With an initial blank line</summary>

Word
```
code
```
</details>
````

renders as:

<details><summary>With an initial blank line</summary>

Word
```
code
```
</details>

## Headings
```text
<details><summary>Without an initial blank line</summary>
Word
###### Heading
Word
</details>
```

renders as:

<details><summary>Without an initial blank line</summary>
Word
###### Heading
Word
</details>

```text
<details><summary>With an initial blank line</summary>

Word
###### Heading
Word
</details>
```

renders as:

<details><summary>With an initial blank line</summary>

Word
###### Heading
Word
</details>

## Inline code
```text
<details><summary>Without an initial blank line</summary>
A sentence with `code` in it.
</details>
```

renders as:

<details><summary>Without an initial blank line</summary>
A sentence with `code` in it.
</details>

```text
<details><summary>With an initial blank line</summary>

A sentence with `code` in it.
</details>
```

renders as:

<details><summary>With an initial blank line</summary>

A sentence with `code` in it.
</details>


## Bullet points (unordered lists)
```text
<details><summary>Without an initial blank line</summary>
- one
- two
- three
</details>
```

renders as:

<details><summary>Without an initial blank line</summary>
- one
- two
- three
</details>

```text
<details><summary>With an initial blank line</summary>

- one
- two
- three
</details>
```

renders as:

<details><summary>With an initial blank line</summary>

- one
- two
- three
</details>

## Numbered lists (ordered lists)
```text
<details><summary>Without an initial blank line</summary>
1. one
1. two
1. three
</details>
```

renders as:

<details><summary>Without an initial blank line</summary>
1. one
1. two
1. three
</details>

```text
<details><summary>With an initial blank line</summary>

1. one
1. two
1. three
</details>
```

renders as:

<details><summary>With an initial blank line</summary>

1. one
1. two
1. three
</details>

## Quote blocks
```text
<details><summary>Without an initial blank line</summary>
> one
> 
> two
> 
> three
</details>
```

renders as:

<details><summary>Without an initial blank line</summary>
> one
> 
> two
> 
> three
</details>

```text
<details><summary>With an initial blank line</summary>

> one
> 
> two
> 
> three
</details>
```

renders as:

<details><summary>With an initial blank line</summary>

> one
> 
> two
> 
> three
</details>

## Bold and italics
```text
<details><summary>Without an initial blank line</summary>
It was a *dark* **stormy** night ***long*** ago
</details>
```

renders as:

<details><summary>Without an initial blank line</summary>
It was a *dark* **stormy** night ***long*** ago
</details>

```text
<details><summary>With an initial blank line</summary>

It was a *dark* **stormy** night ***long*** ago
</details>
```

renders as:

<details><summary>With an initial blank line</summary>

It was a *dark* **stormy** night ***long*** ago
</details>