Open ghost opened 2 years ago
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.
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 />
## Broken
Example 1:
```html
<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 />
Example 4:
````html
<details>
<summary>example 4</summary>
```xml
<test />
Example 5:
````html
<details>
<summary>example 5</summary>
```xml
<test />
### But
1. If I use the `<details>` tag with no empty lines inside `<td>` tag:
````html
<td>
<details><summary>example 6</summary>
```xml
<test />
an error ocurs:
![image](https://github.com/mihaeu/cosmere/assets/55594483/be7fb6b0-a2ad-41f0-809c-5699062338da)
2. With empty line:
````html
<td>
<details><summary>example 6</summary>
```xml
<test />
it looks like this (without dropdown):
![image](https://github.com/mihaeu/cosmere/assets/55594483/f2df3c28-f0e9-4704-9b12-a16dbd120105)
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
Output
Broken
Input
(newline after xml codefences
Output