-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record line numbers on tokens #144
Comments
@djmattyg007, I think that what you propose would be a pretty cool feature. In principal, it shouldn't be hard to implement, yet it would probably require some broader refactoring in order to track & store the context information (line, plus column would be also nice). I would also watch out for possible impact on performance, but I don't expect some human-noticeable difference... I would like to look at this one day, but I don't have much time these days, so, as usually, PRs are welcome in the meantime. :) |
Hi, I have a somewhat similar use case, where I'd like to know the position of translatable content in the Markdown document. I've started on an implementation. It turns out that block tokens are fairly straightforward, but span tokens are more difficult. @djmattyg007: If you could get the starting line number of the paragraph containing the link, would that be of any use to you? Or do you need the line number of the link? |
I need the line number (and ideally the offset on the given line). |
Ok, I have a PR in the works for line numbers on block tokens which may or may not be useful for you. But it depends on #172, so it will have to wait until that one is merged. |
@anderskaplan, while implementing the |
* add tracking of line numbers to block_tokenizer.FileWrapper * assign line numbers to all block tokens during parsing * add line_number as a repr_attribute on all block tokens * update the developer's guide
Thanks to @anderskaplan, we've got this implemented for block tokens in #188. It still doesn't fully cover the original request though (finding out line number for a any, notably span token), so I will leave this issue open for now. |
I'm writing a tool to parse markdown files and verify that links are valid. To be able to provide the most valuable, accurate feedback, I need to be able to display line numbers to the user, so that they know exactly where in a file the broken link is.
Right now this isn't possible, because line numbers aren't recorded on token objects.
The text was updated successfully, but these errors were encountered: