accept tripple dash file URIs as valid links. resolves #250

pull/391/head
tjex 3 months ago
parent 1471c6be2c
commit 2e1b80d59a

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

Loading…
Cancel
Save