Skip to content
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

Markdown links spanning across lines not matched by wiki#link#get_all #147

Open
nickwynja opened this issue Apr 28, 2021 · 1 comment
Open

Comments

@nickwynja
Copy link
Contributor

Description

In markdown, a link that spreads across multiple lines is still considered a valid link. For example, this is a valid markdown link:

I use hard wrapping at 80 characters so if at this point I include [a
link](NonExistentPage) here that spans two lines, `wiki.vim` won't find it.

wiki#link#get_all loops through lines so in the above case it wouldn't find the link with any existing matcher. On an individual basis, I can currently 'fix' these links when I find them but they sometimes get recreated by the auto-wrapping I use in vim.

Minimal working example

Add the above copy to any page and then run WikiGraphCheckLinks. It will not find the broken reference to NonExistentPage.

@nickwynja nickwynja changed the title Markdown links broken across lines not matched by wiki#link#get_all Markdown links spanning across lines not matched by wiki#link#get_all Apr 28, 2021
@lervag
Copy link
Owner

lervag commented Apr 30, 2021

Thanks for opening this issue. I agree that this is a valid issue and I will work on it. But please note, this is a bit complex. For instance. the link "handler", which is used to recognize links for link actions (opening and toggling), is not coupled with the link parser used by :WikiGraphCheckLinks. Thus, if I solve the issue so that the standard link actions work, then it still remains to fix it for the graph parser. As you already noticed, the graph parser uses wiki#link#get_all, which loops through lines - it uses regexes that matches on a line at a time, whereas the wiki#link#get uses buffer search which is not limited in the same manner.

The best would be if I could find a way to couple these things so that #get_all uses the same mechanism, but I'm not sure how easy this is. So my first thought is to do this in two steps:

  • Allow multi-line links for wiki#link#get and wiki#link#open (and related functions).
  • Allow multi-line links for wiki#link#get_all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants