Skip to content

Source Positions

Latest
Compare
Choose a tag to compare
@andrejewski andrejewski released this 06 Apr 03:24
· 4 commits to master since this release

This minor release adds a new parse option includePositions. This is an opt-in feature that when set to true will cause himalaya.parse to emit nodes with a position field, containing start and end points. These points contain the zero-indexed index, line, and column numbers.

See this feature in the README example, the new spec section, and the updated demo page.

See the PR #90 and issue #89 for more information. Currently the position data is limited to only nodes so attributes and tag names do not have associated information, but this may be added later.

Note: this change did uncover some bugs that were fixed as well.

Thanks to @lazarljubenovic for making the issue for this idea. I'm excited to see what it enables, and am very happy to see it implemented so easily and incorporated into tests so well.