Add AutoLink.LabelSegment method

This commit is contained in:
rhysd 2024-02-13 03:09:06 +09:00
parent 848dc66530
commit 7cc53b65bb

View file

@ -503,6 +503,11 @@ func (n *AutoLink) Label(source []byte) []byte {
return n.value.Text(source) return n.value.Text(source)
} }
// LabelSegment returns a source position of label text in a source text.
func (n *AutoLink) LabelSegment() textm.Segment {
return n.value.Segment
}
// NewAutoLink returns a new AutoLink node. // NewAutoLink returns a new AutoLink node.
func NewAutoLink(typ AutoLinkType, value *Text) *AutoLink { func NewAutoLink(typ AutoLinkType, value *Text) *AutoLink {
return &AutoLink{ return &AutoLink{