LinkReferenceDefinition.Line never assigned #144

Closed
opened 2026-01-29 14:28:36 +00:00 by claunia · 3 comments
Owner

Originally created by @labreuer on GitHub (Oct 17, 2017).

I am very interested in markdig tracking the precise source code location for the syntax tree; unfortunately LinkReferenceDefinition.Line never seems set, perhaps because LinkReferenceDefinition is generated from an ICharIterator, which could be a StringSlice, which has no line # information. Was this by design?

If you're ok with LinkReferenceDefinition.TryParse accepting a StringLineGroup.Iterator, that would seem to suffice; it is not currently called with a StringSlice. I'm happy to put together a pull request.

Originally created by @labreuer on GitHub (Oct 17, 2017). I am very interested in markdig tracking the precise source code location for the syntax tree; unfortunately `LinkReferenceDefinition.Line` never seems set, perhaps because `LinkReferenceDefinition` is generated from an `ICharIterator`, which could be a `StringSlice`, which has no line # information. Was this by design? If you're ok with `LinkReferenceDefinition.TryParse` accepting a `StringLineGroup.Iterator`, that would seem to suffice; it is not currently called with a `StringSlice`. I'm happy to put together a pull request.
claunia added the enhancementPR Welcome! labels 2026-01-29 14:28:36 +00:00
Author
Owner

@xoofx commented on GitHub (Oct 17, 2017):

I am very interested in markdig tracking the precise source code location for the syntax tree; unfortunately LinkReferenceDefinition.Line never seems set, perhaps because LinkReferenceDefinition is generated from an ICharIterator, which could be a StringSlice, which has no line # information. Was this by design?

afair no. It's just that line information was added after and a few places could have been missed during the process of adding the spans (I know for example that many extensions are not updated correctly...)

If you're ok with LinkReferenceDefinition.TryParse accepting a StringLineGroup.Iterator, that would seem to suffice; it is not currently called with a StringSlice. I'm happy to put together a pull request.

I don't remember the details, but in LinkReferenceDefinition.TryParse we are already able to output spans for label..etc (via LinkHelper.TryParseLinkReferenceDefinition) so it should be possible to work with this already (as it is only using global Start position from beginning of file so it should be fine...). PR much welcome of course.

@xoofx commented on GitHub (Oct 17, 2017): > I am very interested in markdig tracking the precise source code location for the syntax tree; unfortunately LinkReferenceDefinition.Line never seems set, perhaps because LinkReferenceDefinition is generated from an ICharIterator, which could be a StringSlice, which has no line # information. Was this by design? afair no. It's just that line information was added after and a few places could have been missed during the process of adding the spans (I know for example that many extensions are not updated correctly...) > If you're ok with LinkReferenceDefinition.TryParse accepting a StringLineGroup.Iterator, that would seem to suffice; it is not currently called with a StringSlice. I'm happy to put together a pull request. I don't remember the details, but in `LinkReferenceDefinition.TryParse` we are already able to output spans for label..etc (via `LinkHelper.TryParseLinkReferenceDefinition`) so it should be possible to work with this already (as it is only using global Start position from beginning of file so it should be fine...). PR much welcome of course.
Author
Owner

@MihaZupan commented on GitHub (Jan 18, 2019):

This was fixed by #243

@MihaZupan commented on GitHub (Jan 18, 2019): This was fixed by #243
Author
Owner

@MihaZupan commented on GitHub (Apr 5, 2019):

Closing as resolved

@MihaZupan commented on GitHub (Apr 5, 2019): Closing as resolved
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#144