Skip to content

[FEATURE] Report the line of unresolved references - #1401

Open
linawolf wants to merge 1 commit into
mainfrom
task/link-node-line-numbers
Open

linawolf wants to merge 1 commit into
mainfrom
task/link-node-line-numbers

Conversation

@linawolf

@linawolf linawolf commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

[FEATURE] Report the line of unresolved references

Warnings about references that cannot be resolved only name the file,
which makes them hard to find in large documents. Links are resolved
long after parsing, when the line is no longer known, and text roles
only receive the DocumentParserContext, which has no line.

Link nodes now carry their source location, like DirectiveNode does
since 00e6fab, and the reference resolvers include it in their
warnings. It is set centrally by the InlineParser for every link an
inline rule or text role returns, so rules and text roles added by
extensions are covered without changes, and extensions like
render-guides can use it for their own link warnings.

Signed-off-by: linawolf
Assisted-By: Claude Opus 5.5 (1M context) noreply@anthropic.com

@linawolf
linawolf force-pushed the task/link-node-line-numbers branch 3 times, most recently from 943fe3e to acbb53e Compare October 5, 2026 13:13
Warnings about references that cannot be resolved only name the file,
which makes them hard to find in large documents. Links are resolved
long after parsing, when the line is no longer known, and text roles
only receive the DocumentParserContext, which has no line.

Link nodes now carry their source location, like DirectiveNode does
since 00e6fab, and the reference resolvers include it in their
warnings. It is set centrally by the InlineParser for every link an
inline rule or text role returns, so rules and text roles added by
extensions are covered without changes, and extensions like
render-guides can use it for their own link warnings.

Signed-off-by: linawolf
Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@linawolf
linawolf force-pushed the task/link-node-line-numbers branch from acbb53e to 74b96d3 Compare October 5, 2026 14:49
@linawolf
linawolf requested a review from jaapio October 5, 2026 15:46
*/
public function parse(string $content, BlockContext $blockContext, int|null $firstLineNumber = null): InlineCompoundNode
{
$firstLineNumber ??= $blockContext->getCurrentLineNumber();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we simply feth the current line from the $blockContext? Why do we need to pass it in?

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.

2 participants