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.

Comments on Details tag requires an internal blank line to render markdown

Parent

Details tag requires an internal blank line to render markdown

+1
−0

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
  1. one
  2. two
  3. 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

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+3
−0

[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.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

2 comment threads

Maybe my fix idea doesn't work after all (1 comment)
Looks like not just block level (1 comment)
Looks like not just block level
trichoplax‭ wrote about 2 years ago

The last example in the question shows bold and italics are affected too, so maybe it is all markdown, rather than just block level.