jose-elias-alvarez / obsidian-paste-link

Intelligently paste Markdown links in Obsidian.
MIT License
6 stars 0 forks source link

Paste link title into selected link url #1

Open NomarCub opened 8 months ago

NomarCub commented 8 months ago

The original plugin had this capability. Described in detail here: https://github.com/mii-key/obsidian-links/issues/13

jose-elias-alvarez commented 8 months ago

This isn't something I personally use, but I'm happy to review and accept a PR adding it as a separate command. If you're not up for it, let me know and I can put something together.

NomarCub commented 8 months ago

I probably won't have the time for this soon, but I'm fine if that's what it takes. Could you provide some pointers to how you'd do it? It doesn't seem complicated, but I want to be on the right path. Just so that we are on the same page (you said "separate command"): I'd like to have it as a command that combines both behaviours, contextually. See here (excluding fetching): https://github.com/mii-key/obsidian-links/issues/22#issuecomment-1869143345

jose-elias-alvarez commented 8 months ago

In terms of the logic, it should be pretty simple: get the current selection, check if it looks like a Markdown link, and if so replace the existing title with the current clipboard content.

If you'd like to add the behavior to the existing command, that'll take some more work, since the plugin already does something when pasting if a link is selected: if the clipboard contains a URL, it replaces the link's current URL with the clipboard URL. It might make sense to add a config option to define what happens in this case.

WinHex89 commented 5 months ago

Can you support such URLs like 00:25:07.266

WinHex89 commented 5 months ago

Can you support such URLs like [00:25:07.266](ziyunote://play?path=F:\test\course.mp4&time=00:25:07.266)