cosmere
cosmere copied to clipboard
Code blocks break <details> rendering
Bug Description
Within a details block, rendering of code blocks seems to be broken. Adding an empty line after the opening block breaks the rendering.
How to Reproduce
Works
Input
<details>
<summary>Click here to see build profile </summary>
```xml
<test />
```
</details>
Output
<ac:structured-macro ac:name="expand"><ac:parameter ac:name="title">Click here to see build profile </ac:parameter><ac:rich-text-body><p><code>xml
<test /></code></p>
</ac:rich-text-body></ac:structured-macro>
Broken
Input
(newline after xml codefences
<details>
<summary>Click here to see build profile </summary>
```xml
<test />
```
</details>
Output
<ac:structured-macro ac:name="expand"><ac:parameter ac:name="title">Click here to see build profile </ac:parameter><ac:rich-text-body><p><code>xml</p>
<p><test /></code></p>
</ac:rich-text-body></ac:structured-macro>
After playing around with several ideas, I think the best way here is to highlight the error and have the user fix it. Fixing it automatically would mean rewriting the lexer of marked.
Instead, I tried https://www.npmjs.com/package/node-libxml and verifying that the XML is well-formed does the job.
Hello, @mihaeu!
The bug is repeated not only in code blocks.
If there is an empty line between </summary>
and </details>
tags, rendering details in Confluence fails.
How to Reproduce
Works
Example 1:
<details>
<summary>example 1</summary>
Some text
</details>
Example 2 (this works, but doesn't work in Gitlab, Github, VsCode, and thus when publishing via site generators):
<details>
<summary>example 2</summary>
```xml
<test />
```
</details>
Broken
Example 1:
<details>
<summary>example 1</summary>
Some text
</details>
Example 2:
<details>
<summary>example 2</summary>
Some text
</details>
Example 3:
<details>
<summary>example 3</summary>
```xml
<test />
```
</details>
Example 4:
<details>
<summary>example 4</summary>
```xml
<test />
```
</details>
Example 5:
<details>
<summary>example 5</summary>
```xml
<test />
```
</details>
But
- If I use the
<details>
tag with no empty lines inside<td>
tag:
<td>
<details><summary>example 6</summary>
```xml
<test />
```
</details>
</td>
an error ocurs:
- With empty line:
<td>
<details><summary>example 6</summary>
```xml
<test />
```
</details>
</td>
it looks like this (without dropdown):