Environment
- Operating System:
Windows 11
- Node Version:
v24.16.0
- Package Manager:
bun@1.3.14
- Comark Version:
0.4.0
- Framework:
Vue / Nuxt
Comark Version
v0.4.0
Reproduction
import { parse } from 'comark'
const markdown = `<details>
<summary>Original summary in English</summary>
xxx
</details>`
console.log(JSON.stringify((await parse(markdown)).nodes, null, 2))
Actual output:
[
[
"details",
{
"$": {
"html": 1,
"block": 1
}
},
[
"summary",
{
"$": {
"html": 1,
"block": 1
}
},
"Original summary in English"
]
],
[
"p",
{},
"xxx"
]
]
Expected output should keep xxx inside the details node, for example:
[
[
"details",
{
"$": {
"html": 1,
"block": 1
}
},
[
"summary",
{
"$": {
"html": 1,
"block": 1
}
},
"Original summary in English"
],
[
"p",
{},
"xxx"
]
]
]
Description
GitHub-style collapsed sections using <details> / <summary> are not parsed correctly when the <summary> line is followed by a blank line.
Input:
<details>
<summary>Original summary in English</summary>
xxx
</details>
In GitHub Markdown, the body content remains inside the <details> block and is hidden until expanded. GitHub's Markdown API renders this as:
Original summary in English
xxx
Comark currently parses xxx as a sibling after the details node. Framework renderers then faithfully render the AST as:
Original summary in English
xxx
This breaks GitHub-compatible rendering for collapsed sections.
The issue appears related to raw HTML block handling. <details> / <summary> are treated as block HTML, and the blank line after <summary> appears to terminate the HTML block before is reached.
Additional context
No response
Logs
Environment
Windows 11v24.16.0bun@1.3.140.4.0Vue / NuxtComark Version
v0.4.0
Reproduction
Actual output:
[ [ "details", { "$": { "html": 1, "block": 1 } }, [ "summary", { "$": { "html": 1, "block": 1 } }, "Original summary in English" ] ], [ "p", {}, "xxx" ] ]Expected output should keep xxx inside the details node, for example:
[ [ "details", { "$": { "html": 1, "block": 1 } }, [ "summary", { "$": { "html": 1, "block": 1 } }, "Original summary in English" ], [ "p", {}, "xxx" ] ] ]Description
GitHub-style collapsed sections using
<details>/<summary>are not parsed correctly when the<summary>line is followed by a blank line.Input:
In GitHub Markdown, the body content remains inside the
<details>block and is hidden until expanded. GitHub's Markdown API renders this as:Original summary in English
xxx
Comark currently parses xxx as a sibling after the details node. Framework renderers then faithfully render the AST as:
Original summary in English
xxx
This breaks GitHub-compatible rendering for collapsed sections.
The issue appears related to raw HTML block handling.
<details> / <summary>are treated as block HTML, and the blank line after<summary>appears to terminate the HTML block before is reached.Additional context
No response
Logs