apple/swift-markdown

Allow access to the range for a link's destination

Opened this issue · 0 comments

There are a few different ways to write links in markdown:

[link text](https://example.com)

<https://example.com>

[link text][1]
  
[1]: https://example.com

The Link type provides access to the range and destination but it doesn't provide access to the range of the destination.

A client can workaround this limitation in the first two cases where the destination exist within the content of the range but in the third example the range only covers this content [link text][1].

Swift-DocC has a use-case where it verifies links in the documentation content and raises diagnostics about unresolvable links. In these diagnostics it's helpful to have access to the range of the link destination to be able to make accurate suggestions on how to correct the link.