+14
appview/pages/markup/extension/atlink.go
+14
appview/pages/markup/extension/atlink.go
···
36
}
37
38
var atRegexp = regexp.MustCompile(`(^|\s|\()(@)([a-zA-Z0-9.-]+)(\b)`)
39
+
var markdownLinkRegexp = regexp.MustCompile(`(?ms)\[.*\]\(.*\)`)
40
41
type atParser struct{}
42
···
56
if m == nil {
57
return nil
58
}
59
+
60
+
if !util.IsSpaceRune(block.PrecendingCharacter()) {
61
+
return nil
62
+
}
63
+
64
+
// Check for all links in the markdown to see if the handle found is inside one
65
+
linksIndexes := markdownLinkRegexp.FindAllIndex(block.Source(), -1)
66
+
for _, linkMatch := range linksIndexes {
67
+
if linkMatch[0] < segment.Start && segment.Start < linkMatch[1] {
68
+
return nil
69
+
}
70
+
}
71
+
72
atSegment := text.NewSegment(segment.Start, segment.Start+m[1])
73
block.Advance(m[1])
74
node := &AtNode{}