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

Follow reference style links #777

Open
einarpersson opened this issue Nov 24, 2024 · 0 comments
Open

Follow reference style links #777

einarpersson opened this issue Nov 24, 2024 · 0 comments

Comments

@einarpersson
Copy link

einarpersson commented Nov 24, 2024

🚀 The feature, motivation and pitch

Background

Due to limitations in vim / neovim markdown links / wiki links will cause weird wrapping behaviour. This is not something that will be fixed any time soon.

Suggestion

Make it easier to use reference style links. I have installed link.vim and it works pretty well.

The wrapping issue is much less of an issue when the links are done this way:

# Notes

[Vim][0] and [Neovim][1] are text editors.

[My dog][2] is 5 years old

## Links

[0]: https://example.com/very/long/path/with/many/segments/and?param1=value1&really_long_parameter_name=extremely_long_value_that_keeps_going
[1]: https://anotherexample.com/very/long/path/with/many/segments/and?param1=value1&really_long_parameter_name=extremely_long_value_that_keeps_going
[2]: my-dog.md

So what is missing?

  1. smart_action should follow internal reference style links
  2. follow_url_func should have the url value populated by the matching reference entry (if valid url)

(Also: i have opened a related feature request in link.vim to support converting internal markdown links to this style also, as it currently only supports urls)

Alternatives

Create a wrapper function for the smart_action myself.

Additional context

  • I don't know if there would be a wikistyle equivalent. Perhaps it is wisest to restrict oneself to just markdown link styles for this so that we don't need to come up with new syntax.

  • I am using this plugin together with render-markdown for the rendering part. This feature request is only about the smart action.

To sum up: I propose that we improve smart_action and follow_url_func by understanding reference style links. This would help alleviate a major and currently "unsolvable" problem with using neovim for obsidian.

Update: 2024-11-26

link.vim is starting to support this in its dev branch and it looks very promising. Regarding obsidian.nvim I realized that what would really be nice is to have another option

  -- Either 'wiki', 'markdown' or 'reference'
  preferred_link_style = "reference",

which would add links like this

[This][0] is a link to a file.

## Links
[0]: filename-here.md

Read through qadzek/link.vim#14 for details / variants. A complication is that the link has to be inserted in the right place and any links after it has to be incremented. Also, there has to be an option for reference list header (eg. "Links" as in the example above)

I feel this is right on track. If this isn't implemented in this plugin I'll find away around it (build my own smart action function) but I do think this should be interesting to more people and just me. As a fallback - if you do not want to or have the capacity to implement it - it could perhaps be added to the README.md (instruction on how to use this plugin together with link.vim).

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

No branches or pull requests

1 participant