Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix location with nested lists #131
When parsing nested lists, the reported location of the sub lists is off by one. I believe I've tracked it down to the following: when a nested list is detected, an EOB marker is inserted, causing the line numbers for everything parsed afterward to be increased by 1. This PR corrects for this by decreasing the line number once an EOB marker is detected.
I'm not sure this is the best way to fix the issue (I had to make Kramdown::Utils::StringScanner.start_line_number writable), and you might want to implement it differently.
Test case is included, but to illustrate the issue in a standalone file:
I spotted that EOB marks are explicit kramdown syntax and not an internal-only thing, and realized that the fix probably messes up location values for documents with explicit EOB marks in. However, when I tested this, it doesn't seem to be an issue. I added another commit to add tests for this, as well as a slightly more complex nested list.