Skip to content
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

Add location to AST #176

Closed
cmkilger opened this issue Sep 5, 2015 · 2 comments
Closed

Add location to AST #176

cmkilger opened this issue Sep 5, 2015 · 2 comments

Comments

@cmkilger
Copy link

cmkilger commented Sep 5, 2015

I'd like to get the location of each node of the tree relative to the original input text, either line/column or number of characters from the beginning. I was looking for a way to add it, but I don't quite understand the code that well yet, and it didn't seem straight forward to implement.

@cmkilger
Copy link
Author

cmkilger commented Sep 5, 2015

And I do see start and end lines for blocks, but I want it for each inline as well, e.g. text, emphasis, html, etc. I also saw that the start line wasn't set for some headers. Bug?

@colinodell
Copy link
Member

I do see start and end lines for blocks, but I want it for each inline as well, e.g. text, emphasis, html, etc.

Unfortunately source positions for inline elements aren't always useful: commonmark/commonmark.js#64 (comment)

I'd like to monitor how the upstream projects handles this (possibly using source maps instead) and the implement the same approach for consistency. I'm therefore going to close this issue (for now, at least).

See also:

I also saw that the start line wasn't set for some headers. Bug?

Quite possibly. If you wouldn't mind opening a separate issue (with some examples of this bug) I'd greatly appreciate it!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants