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 NoteLink.position to keep track of link ranges #108

Merged
merged 1 commit into from
Jul 14, 2020

Conversation

jevakallio
Copy link
Collaborator

@jevakallio jevakallio commented Jul 13, 2020

Cherry-picked this off from #107, as it's likely we'll need this for other core/janitor features before the spike can land.

  • Adds NoteLink.position field to attach Markdown AST positional information to links, to be used by VS Code providers.
  • Uses the unist types directly as they are just plain interfaces.

to: node.value as string,
text: node.value as string,
position: node.position!
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically node.position may be null, but this should only be the case when the links have been generated/appended to the tree and not yet committed. The nodes here are always in markdown, and therefore should always have positions.

Copy link
Collaborator

@riccardoferretti riccardoferretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@jevakallio jevakallio merged commit d7b930f into master Jul 14, 2020
@jevakallio jevakallio deleted the core/add-note-link-position branch July 14, 2020 07:04
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

Successfully merging this pull request may close these issues.

2 participants