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

Add support for markdown reference-style link #925

Open
JasonMFry opened this issue Jun 21, 2020 · 14 comments
Open

Add support for markdown reference-style link #925

JasonMFry opened this issue Jun 21, 2020 · 14 comments

Comments

@JasonMFry
Copy link

@JasonMFry JasonMFry commented Jun 21, 2020

I'd like support for markdown reference-style links. I don't like using inline links b/c it makes the line length very long, and if I wrap the line it almost always breaks up the markdown link, which I also don't like. Support for reference-style links would address both of those issues.

This is what "support" means to me:

  1. Pressing enter on a word creates a reference-style link
  2. Pressing enter on a reference-style link takes you to the link

I've just started using vimwiki in the past week so maybe there are more things that "support" should mean but that's all I can think of.

I'm willing to put up a PR for this, especially if someone points me in the right directions to get started, but it may very well take months for me to finish b/c I don't have much free time.

This is related to #538

@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Jul 21, 2020

#936
vars.vim
spagethi code warning

@patdavid
Copy link

@patdavid patdavid commented Sep 3, 2020

I'd be willing to help however I can for this also, although I might require some hand-holding at first. I can promise I will do my best to learn, though.

Reference-style links are important enough for me to at least try to help. :)

@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Sep 3, 2020

Hi,

Good initiative @patdavid read vimwiki#base#follow_link. I am glad to see some motivation to contribute to vimwiki and try to make a code documentation whenever possible. @JasonMFry have a look at #1005. It may take 5h of reading code, to understand how plugin and ftplugin are adding commands linking to autoload/base which uses all other files. u.vim sandars for util and vars.vim is to keep all user configuration variable in one place as explained here.

@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Oct 20, 2020

Little doc for the brave coder.

Link reference definition convert:

- [2020-07-11-three-weeks-in]

[2020-07-11-three-weeks-in]: blog/2020-07-11-three-weeks-in.md "Three Weeks In"

in

<ul>
<li><a href="blog/2020-07-11-three-weeks-in.md" title="Three Weeks In">2020-07-11-three-weeks-in</a></li>
</ul>
@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Oct 20, 2020

@patdavid if you make the PR before November you gain 1/4 of Hacktoberfest T-shirt Yeepi

@apruden2008
Copy link

@apruden2008 apruden2008 commented Oct 21, 2020

@tinmarino I started using Vim this year and love it. Recently discovered this plugin and think it's wonderful for many applications. Not sure if anyone is still working on this but I'd love to give it a go.

@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Oct 21, 2020

Hello @apruden2008,
Glad to hear from you. Just give it a go. @patdavid would be so glad to have his golden feature done.

In absence of any return after a month, I may reafect it to another person. Don't feel stress or pushed thought, I said "return" not code, just a sign of life if someone pings here.

Feel free to ask but you may not receive answers because there are so many tickets, sometimes I loose myself.

@apruden2008
Copy link

@apruden2008 apruden2008 commented Oct 21, 2020

Thanks. Quick clarification @patdavid on the implementation. Pressing right now creates an embedded link in vimwiki. Should there be some kind of flag the user can set to differentiate between embedded and reference style? Or should this reassign to only create reference style links?

I personally prefer the option, so that's how I'm going to start implementing for now.

@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Oct 22, 2020

Opcion: link_type = reference or web
That will enable us to add the [[link]] type later

@apruden2008
Copy link

@apruden2008 apruden2008 commented Oct 26, 2020

The regex patterns in here are dense. Any tips on how to decipher or how to get up to speed? I know some basic regex but this is very hard to parse:

[[[^\]]{-}%(|[^\]]{-})?]]|[][]@<![[^\[]]{-}][][][]@ !|[][]@<![[^\[]]{-}][[^\[]]{-}][][]@!

@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Oct 27, 2020

@apruden2008 good question. I think there is no way.
What I do is copy it in a draft and separe whaa is separable with spaces, new lines and comments. But each one of us has to do it again an again.
The best dev can do it to create a regex factory file and parametrize, configure them.
In adition, there is often a match and search pattern that are almost equivalent => code duplication.
Feel free to make some PR with only comments and refactorings.
Sorry ..

@apruden2008
Copy link

@apruden2008 apruden2008 commented Oct 27, 2020

No worries. I'm here to contribute to an open-source project that I like and use, not to earn a free t-shirt. Moreover, it's good practice. But I understand if you want to prioritize it and pass to a regex pro. But until then, I'll keep hacking at it and see what I can come up with.

@tinmarino
Copy link
Collaborator

@tinmarino tinmarino commented Oct 27, 2020

@patdavid
Copy link

@patdavid patdavid commented Oct 27, 2020

Sorry, was afk for the weekend. I really have the best intentions to try and help out, but am stretched a bit thin at the moment so haven't had a chance to. I apologize.

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.