|
|
@ -228,9 +228,12 @@ func (d *document) DocumentLinks() ([]documentLink, error) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for _, match := range markdownLinkRegex.FindAllStringSubmatchIndex(line, -1) {
|
|
|
|
// extract link paths from [title](path) patterns
|
|
|
|
// Ignore embedded image, e.g. ![title](href.png)
|
|
|
|
for _, match := range
|
|
|
|
if match[0] > 0 && line[match[0]-1] == '!' {
|
|
|
|
markdownLinkRegex.FindAllStringSubmatchIndex(line, -1) {
|
|
|
|
|
|
|
|
// case: '!' ignores embedded image, e.g. ![title](href.png)
|
|
|
|
|
|
|
|
// case: '/' ignores tripple dash file URIs, e.g. file:///file.go
|
|
|
|
|
|
|
|
if match[0] > 0 && line[match[0]-1] == '!' || line[match[3]+8] == '/' {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -242,6 +245,7 @@ func (d *document) DocumentLinks() ([]documentLink, error) {
|
|
|
|
appendLink(href, match[0], match[1], false, false)
|
|
|
|
appendLink(href, match[0], match[1], false, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, match := range wikiLinkRegex.FindAllStringSubmatchIndex(line, -1) {
|
|
|
|
for _, match := range wikiLinkRegex.FindAllStringSubmatchIndex(line, -1) {
|
|
|
|
href := line[match[2]:match[3]]
|
|
|
|
href := line[match[2]:match[3]]
|
|
|
|
hasTitle := match[4] != -1
|
|
|
|
hasTitle := match[4] != -1
|
|
|
|