-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: magnet link #429
fix: magnet link #429
Conversation
Thanks for the pr :) The approach so far for appeasing the LSP is to ignore urls that are not links to notes. #391 is an example of this. Here in zk/internal/adapter/lsp/document.go Line 295 in 739d2d4
I think it's still a better approach than adding a magnet link scheme to a) it reduces load on the lsp and While a magnet link is in essence a url, for our purposes, it may be cleaner to just ignore it rather than validate it? Happy for any counter thoughts. |
Thanks for the feedback! I missed the file and line you mentioned in document.go. I see your point about ignoring URLs that are not links to notes, as shown in PR #391. Just to provide more context that I use obsidian and zk . And on the obsidian there was no linting error. And I could just click the magnet link easily. If I were using exclamation on the front and using back tick it will clutter my obsidian view. What if I add something like this on existing // ignore tripple dash file URIs [title](file:///foo.go)
if match[5]-match[4] >= 8 {
linkURL := line[match[4]:match[5]]
fileURIresult := linkURL[:8]
if fileURIregex.MatchString(fileURIresult) {
continue
}
// Ignore magnet
if regexp.MustCompile(`magnet:?`).MatchString(fileURIresult) {
continue
}
} |
That's quite convenient that it's also 8 chars. May as well add it in the same So: magnetRegex := regexp.MustCompile(`magnet:?`)
// ignore tripple dash file URIs [title](file:///foo.go) and magnet links
if match[5]-match[4] >= 8 {
linkURL := line[match[4]:match[5]]
fileURIresult := linkURL[:8]
if fileURIregex.MatchString(fileURIresult) || if magnetRegex.MatchString(fileURIresult) {
continue
}
} Double check you don't need to escape the |
I've updated the commit. Let me know if adjustments are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks :)
Context:
