Repository navigation
Conversation
finalize took a setext heading's end position from the current line, as it does for the document and for a fenced code block closed by its fence. But a setext heading is finalized only when the line after its underline is processed, so it ended on that line: at the end of the next paragraph's first line (3:3 for "Foo\n---\nbar\n"), or at column 0 of a following blank line. Compute its end like other blocks, from the previous line. Fixes commonmark#659. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #659.
finalizetook a setext heading's end position from the current line, as it does for the document and for a fenced code block, which is closed on its own fence line. A setext heading, though, is finalized only when the line after its underline is processed, so it ended on that line:Foo\n---\nbar\n1:1-3:31:1-2:3Foo\n---\n\nbar\n1:1-3:01:1-2:3Foo\n---\r\nbar\n1:1-3:31:1-2:3Foo\n---\n1:1-2:31:1-2:3This removes the setext case from that branch, so the heading's end is computed from the previous line like other blocks. The last case, at the end of the document, already went through the end-of-input branch and is unchanged.
Adds
source_pos_setext_headingtoapi_testwith all four inputs; the first three fail without the fix. On macOS,ctestpasses for a shared Debug build and for a static Debug build with-fsanitize=address,undefined, andmake lintis clean.🤖 Generated with Claude Code