Commit 55ecdae5 authored by Steven's avatar Steven

chore: fix auto link matcher

parent ef732993
...@@ -29,6 +29,18 @@ func (*AutoLinkParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { ...@@ -29,6 +29,18 @@ func (*AutoLinkParser) Match(tokens []*tokenizer.Token) (ast.Node, int) {
urlStr = tokenizer.Stringify(matchedTokens[1 : len(matchedTokens)-1]) urlStr = tokenizer.Stringify(matchedTokens[1 : len(matchedTokens)-1])
isRawText = false isRawText = false
} else { } else {
contentTokens := []*tokenizer.Token{}
for _, token := range matchedTokens {
if token.Type == tokenizer.Space {
break
}
contentTokens = append(contentTokens, token)
}
if len(contentTokens) == 0 {
return nil, 0
}
matchedTokens = contentTokens
u, err := url.Parse(tokenizer.Stringify(matchedTokens)) u, err := url.Parse(tokenizer.Stringify(matchedTokens))
if err != nil || u.Scheme == "" || u.Host == "" { if err != nil || u.Scheme == "" || u.Host == "" {
return nil, 0 return nil, 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment