Environment
- Operating System:
Linux (WSL2)
- Node Version:
v24.17.0
- Package Manager:
pnpm@11.11.0
- Comark Version:
0.5.1 (reproduces on current main)
- Framework:
None
Comark Version
v0.5.1
Reproduction
import { parse } from 'comark'
console.log(JSON.stringify((await parse('See :badge[] here')).nodes))
// [["p",{},"See ",["badge",{},"!["],"(i.png)] here"]] ← chopped at the `]` of `] b')).nodes))
// same shape — the link half-parses outside the component
Description
parseBracketContent scans for the first unescaped ] with no depth tracking, so any bracket-bearing construct inside a component's content — images, links, nested [spans] — terminates it early and spills the remainder into the paragraph as corrupted text. This is plain hand-written markdown, no stringifier involved.
The inline span rule already does depth counting, which is why []{.cls} parses fine while :badge[] doesn't. Sharing that scan fixes both call sites at once (inline component and block fence params, so ::card[] too).
Known residual once depth-counted: a code span containing ] inside the content (:badge[`a]b`]) still mis-parses, a bracket counter can't see backticks. Rare enough that I'd document it rather than special-case it, but personal preference
also for this one fix + tests ready locally, PR incoming
Additional context
Adjacent area to #287 / #288 (bracketed link labels), the fix keeps #288's behavior intact, its SPEC fixtures stay green. Distinct from #256 (consecutive inline components), which is about component start detection, not content termination.
Logs
Environment
Linux (WSL2)v24.17.0pnpm@11.11.00.5.1(reproduces on currentmain)NoneComark Version
v0.5.1
Reproduction
Description
parseBracketContentscans for the first unescaped]with no depth tracking, so any bracket-bearing construct inside a component's content — images, links, nested[spans]— terminates it early and spills the remainder into the paragraph as corrupted text. This is plain hand-written markdown, no stringifier involved.The inline span rule already does depth counting, which is why
[]{.cls}parses fine while:badge[]doesn't. Sharing that scan fixes both call sites at once (inline component and block fence params, so::card[]too).Known residual once depth-counted: a code span containing
]inside the content (:badge[`a]b`]) still mis-parses, a bracket counter can't see backticks. Rare enough that I'd document it rather than special-case it, but personal preferencealso for this one fix + tests ready locally, PR incoming
Additional context
Adjacent area to #287 / #288 (bracketed link labels), the fix keeps #288's behavior intact, its SPEC fixtures stay green. Distinct from #256 (consecutive inline components), which is about component start detection, not content termination.
Logs