Skip to content

Commit

Permalink
Fixed issue when link lines use tabs instead of spaces. Now support b…
Browse files Browse the repository at this point in the history
…oth.
  • Loading branch information
a-h committed Sep 13, 2020
1 parent e486d76 commit 4c1d4d2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,14 @@ type LinkLine struct {
}

func (l LinkLine) URL(relativeTo *url.URL) (u *url.URL, err error) {
urlString := strings.TrimPrefix(l.Text, "=>")
urlString = strings.TrimSpace(urlString)
urlString = strings.SplitN(urlString, " ", 2)[0]
u, err = url.Parse(urlString)
var urlString []rune
for _, r := range strings.TrimSpace(strings.TrimPrefix(l.Text, "=>")) {
if unicode.IsSpace(r) {
break
}
urlString = append(urlString, r)
}
u, err = url.Parse(string(urlString))
if err != nil {
return
}
Expand Down

0 comments on commit 4c1d4d2

Please sign in to comment.