Skip to content

Fix source spans for unclosed reference titles - #461

Open
sean0407 wants to merge 3 commits into
commonmark:mainfrom
sean0407:codex/commonmark-unclosed-reference-title
Open

sean0407 wants to merge 3 commits into
commonmark:mainfrom
sean0407:codex/commonmark-unclosed-reference-title

Conversation

@sean0407

@sean0407 sean0407 commented Oct 10, 2026 •

Copy link
Copy Markdown

Fixes #460.

When a link reference definition has an unclosed title that starts on a later line, the parser currently keeps the partial title and assigns that line's source span to the definition. The same line remains paragraph content, but its paragraph node has no source span.

Record where title spans begin. If the paragraph ends while the parser is still reading a title, discard the partial title and leave those later-line spans with the paragraph. The regression test checks the definition title and both nodes' source spans.

Verification:

  • git diff --check passed.
  • Project patch policy accepted: 2 files, 39 changed lines, no binary changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unclosed link reference definition title keeps the partial title and the following paragraph's source spans (0.30.0)

2 participants