Conversation
Warnings logged while parsing report a currentLineNumber that is only right at the top level of a document. Nested BlockContexts received their parent's iterator key as offset, which counts from the start of the parent's content, not from the start of the file. Inside a directive, list, definition list or table the reported line was relative to that block, and paragraphs counted their offset twice: a directive in a list item on line 8 was reported as line 3. BlockContext's lineOffset now always is the number of lines in the file before its content, including leading blank lines LinesIterator strips, and every production passes the absolute offset of its sub-content. A directive without content is located at its own line. Grid table cells are located at the table's first line, as rows don't keep the lines they were parsed from. This is groundwork for reporting the line of unresolved references. Signed-off-by: linawolf Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Addresses review feedback on #1402: BlockContext needed the number of lines of its iterator and got it by copying them out with toArray(). LinesIterator now implements Countable, so the count is asked for directly. The new LinesIteratorTest also showed that a blank document reported one leading line removed, from the newline prepareDocument() appends. A blank document has no first line to map, so it now reports none. Signed-off-by: linawolf Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
force-pushed
the
task/link-node-line-numbers
branch
from
October 1, 2026 11:04
c4d7776 to
93d6346
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.
[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
Depends on #1402, which makes the line numbers absolute; until
it is merged, this PR also contains its commit.