Repository navigation
fix: resolve reference links whose definition is in another block - #666
Merged
Merged
Conversation
Contributor
|
@DevVettel is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
✅ All commits are signedAll 1 commit(s) in this pull request have a verified signature. Thanks! Checked at 9265f92. |
Each block is parsed into its own mdast tree, so `[text][1]` stayed as raw text when `[1]: url` was in a different block. Keep documents with link reference definitions in one block, as is already done for footnotes. Definitions are detected with the marked lexer, so nested definitions (blockquotes, list items) are found and lines inside code are ignored. The incremental path falls back to a full parse when the tail adds one. Fixes vercel#665 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DevVettel
force-pushed
the
fix/cross-block-link-references
branch
from
October 11, 2026 09:27
7a7f980 to
9265f92
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #665 (reference link part).
Cause: each block is parsed into its own mdast tree, so a
[1]: urldefinition in another block is invisible to[text][1], which renders as raw text.Fix: keep documents with link reference definitions in a single block, the same way documents with footnotes already are. Definitions are detected via the marked lexer (
lexer.tokens.links), so nested ones (blockquotes, list items) are found and definition-like lines inside code are ignored. The incremental path falls back to a full parse when the tail adds a definition.Tests:
__tests__/link-references.test.tsxcovers rendering, collapsed/shortcut references, nested definitions, code-block false positives, and streaming equivalence with a full parse. 4 of the 6 fail without the fix; full suite passes.Not changed: the loose list part of the issue. Unwrapping the single
<p>in loose list items is intentional since #476 (list-item-paragraphs.test.tsx), so I left that behaviour as is.🤖 Generated with Claude Code