The source is initially parsed by CMark and then this code parses individual fenced code blocks.
This sets the initial state for the code block parser so that source locations and error excerpts match the source file.
Implementation notes
Provides a custom initial parser state to the parser with the starting position adjusted to match the overall file.
This also changes the way the parser combines the info string and the body, to avoid further mangling of state that can affect the offset, etc.
Interesting/controversial decisions
This guesses at the exact form of the opening fence, since I don’t think we can recover that from the CMark structure. But the guess is used consistently, so any code excerpts displayed in the error line up correctly.
Test coverage
This adds a couple of intentionally-failing transcripts. It also writes output files for intentional transcript parsing errors, since that’s what these are and the results previously weren’t checked.
Overview
The source is initially parsed by CMark and then this code parses individual fenced code blocks.
This sets the initial state for the code block parser so that source locations and error excerpts match the source file.
Implementation notes
Provides a custom initial parser state to the parser with the starting position adjusted to match the overall file.
This also changes the way the parser combines the info string and the body, to avoid further mangling of state that can affect the offset, etc.
Interesting/controversial decisions
This guesses at the exact form of the opening fence, since I don’t think we can recover that from the CMark structure. But the guess is used consistently, so any code excerpts displayed in the error line up correctly.
Test coverage
This adds a couple of intentionally-failing transcripts. It also writes output files for intentional transcript parsing errors, since that’s what these are and the results previously weren’t checked.