Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix auto link matcher

Steven55ecdae509a0
diff --git a/plugin/gomark/parser/auto_link.go b/plugin/gomark/parser/auto_link.go
index 56353798d..d04db64c8 100644
--- a/plugin/gomark/parser/auto_link.go
+++ b/plugin/gomark/parser/auto_link.go
@@ -29,6 +29,18 @@ func (*AutoLinkParser) Match(tokens []*tokenizer.Token) (ast.Node, int) {
urlStr = tokenizer.Stringify(matchedTokens[1 : len(matchedTokens)-1])
isRawText = false
} 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))
if err != nil || u.Scheme == "" || u.Host == "" {
return nil, 0