denolehov / obsidian-url-into-selection Goto Github PK
View Code? Open in Web Editor NEWPaste URLs into selected text "notion style"
Paste URLs into selected text "notion style"
The plugin tries to load the following ressource, resulting in Error 404: https://github.com/denolehov/obsidian-url-into-selection/releases/download/1.6.0/styles.css
Plugin shouldn't load external ressources at all if not needed (which seems for me to be the case).
Obsidian: v0.12.12
Plugin: 1.6.0, installed via Obsidian
The description used by the plugin search doesn't include the word "link", making it harder to find than it needs to be.
Hi,
I was looking for plugin that can fetch titles of pages when I paste URLs into the note. I found this but it does it on command. This is too many steps, especially since I paste a lot of URLs.
Your plugin does something similar on paste, I'd like to make a PR for an additional option:
const options: Record<NothingSelected, string> = {
0: "Do nothing",
1: "Auto Select",
2: "Insert [](url)",
3: "Insert <url>",
4: "Fetch [<Page title>](url)",
};
Is that something you'd be interested in?
Thanks for the great plugin. I often highlight text in a code block that I want to replace with clipboard text. It would be nice to have an option to disable this plugin in these situations (interacting with text within a code block) to permit pasting to replace text. You wouldn't want an image within a code block so I don't see a downside to this.
When I paste a markdown link like [test](test.com)
, the extension will recognize this string as an URL and turn it into [](<[test](test.com)>)
Issue Description
Pasting a URL into selected text suddenly stopped working.
Steps to Reproduce
Expected Behavior
Text is is modified in the following format
[original text](pasted-url)
Observed Issue
Text gets replaced with pasted URL
Additional Data
Obsidian v0.13.19
macOS 12.1
Paste URL into selection Version 1.6.0
Tried restarting Obsidian, un/re-installing plugin. Issue persists across all vaults.
Any ideas for a fix?
I have updated to v1.7.0 and I find that when I normally (ctrl + v) paste tags the tag is formatted as .
I have tried altering the regular expression but the undesired behaviour persists.
I have a separate hotkey for triggering this plugin, and I would prefer the option to turn off automatically triggering.
It would be a very good idea if we could directly have the title of the page as the url name in just one ctrl + v
paste. So all we need to do is copy a URL say https://en.wikipedia.org/wiki/JavaScript
and paste in obsidian giving:
[JavaScript - Wikipedia](https://en.wikipedia.org/wiki/JavaScript)
-> JavaScript - Wikipedia
Further, if the text inside the square brackets gets highlighted, we could edit and have the name we want. All of this in minimum effort.
Use case:
Paste links with 'highlight text fragment features', like this one:
This one does not:
https://github.com/denolehov/obsidian-url-into-selection#user-content-paste-url-into-selection:~:text=selected%20link%20(URL)%20by%20command
That's the result:
I suppose it's the brackets that breaks it.
Expected behaviour:
Link with brackets should work OK.
I'm getting some additional garbage before and after the copied text when pasting into Obsidian.
"[](<"
precedes the copied text, and ">)"
follows it. The problem clears up if I disable Paste URL into Selection.
Running Obsidian v0.12.4 and Paste URL into Selection v1.6.0 on macOS Big Sur 11.4 on Intel
Is there some Obsidian setting that I need to tweak?
I've noticed that the plugin overtriggers a lot when copy and pasting code, which has become more frustrating as I've started to use the Templater and Dataview plugins more.
After playing around with the regex tester on https://regexr.com, I found that the default fallback regex would match many function calls or object references. For example, the fairly straight forward templater expression <% tp.date.now(fmt_month, 0, tp.file.title, fmt_week) %>
actually matches twice – once on tp.date.now(fmt_month
and a second time on tp.file.title
. While the second match is more understandable, as it could technically be a real URL with a weird TLD, I think that a fallback expression should not be prone to overtriggering.
As a less sensitive option, I'm suggesting that ((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]
#|]+)` be used at the default fall back regex. In my (albeit brief) testing, I've found this to be much less prone to overtriggering and overall less frustrating to use copy and paste in my notes when working with templates and queries.
Fore me (and i think for some other users of this plugin) it's important to leave standard paste functionality as it is. Here i just disabled it in the source code.
But it's not hard to add this as an option. It's really useful option.
I'm using this is conjunction with the media-extended plugin, and it's so close to working great.
However, when pasting embeddable links with this plugin I still need to manually add a ! in front of every pasted link, to create the ![]()
extended image syntax.
It would be great if you could whitelist certain sites with this plugin to automatically add the ! in front when pasting.
That way you could embed Youtube links (for example) as quick as you could paste them, would be really useful.
There are some bugs when pasting raw URLs into the example.com
portion of [example](example.com)
.
Demo: paste google.com
into [example](paste_here)
. It will format as [example]([ ](google.com))
.
I propose allowing for the standard use of Ctrl + Shift + V for non-formatted pasting. This could be a great workaround for some issues other people are having in some of the other requests. Current I have to disable the plugin when editing a lot of hyperlinks.
As title describes, the plugin literally does not function at all inside Kanban boards.
esp with long urls, it is some work to select and paste. How nice would it be to support pasting into cursor position, expanding to the surrounding space (and/or other regex) separated bit, then business as usual?
This plugin is awesome as it implements one of my preferred Typora's functionalities : automatic handling of URL pasting.
I love being able to copy a URL, select some text (or not if I just want one word) then ctrl+K
to automagically make a perfect Markdown link.
However, I really don't want to use ctrl+v
for that, and this plugin even though I set a hotkey to ctrl+k
continues to override ctrl+v
and it shows each time I paste something that is detected wrongfully or not as an URL : as an example, pasting <% tp.file.cursor() %>
anywhere gives [](<%3C% tp.file.cursor() %%3E>)
and using shift+ctrl+v
doesn't bypass this, so I have to either manually delete all the junk added by the plugin or stop using the plugin :'(
Please, just use the hotkey setting to activate the plugin !
I have tried to put my cursor inside the word and paste it but somehow it's inserted as default text and it happens also with the third way. Thank you
As the title states, when trying to paste any text with formatting from the browser into Obsidian, when doing it using the ctrl+shift+v shortcut nothing happens.
I'm suddenly encountering a strange problem wherein the paste does not work to paste-as-link on every other paste.
See this...
Love this plugin otherwise.
I have a string of text that I highlight, and use CTRL+V to paste the link. It changes the text to the name of the note and the link rather than leaving just the highlighted text.
Example:
Click Link Here
when highlighted and paste the new link, it changes it to:
[[10. Links#Header1]]
It should make it:
[[10. Links#Header1|Click Link Here]]
any way to keep the highlighted text without having to manually enter it in every time?
I do not know since what version, but Obsidian's Paste action (Cmd+V) is now smart. If I copy a link, it will create me a link with a text taken from page heading. Or if I copy a clickable text, Obsidian will preserve the link. Sometimes I just want to paste something as a raw text from my clipboard. And there is a Cmd+Shift+V for this:
But with this plugin the default shortcut does not work and I have to Right-click and use the above menu to paste raw text.
I like this plugin and still want to use it, but I would like to have a way to resolve the conflict with a default Cmd+Shift+V behavior.
Possible solution: if no text is selected by cursor, preserve the original behavior
I changed the hotkey from Ctrl + V
to Ctrl + Shift + V
. While Ctrl + Shift + V
now activates the plugin, Ctrl + V
also activates the plugin.
After changing the hotkey from Ctrl + V
to Ctrl + Shift + V
, Ctrl + V
should paste as normal and not activate the plugin.
Ctrl + Shift + V
[word](url)
instead of just url
.Plugin Version: 1.6.0
Obsidian Version: 0.12.5
It looks like this issue was noted here... But the issue still persists
It would be a very useful feature to be able to use this plugin on Wiki Links, so that you could select some text that you would like to be the alias, which would be automatically added to a new link you create.
It might work like this:
alias
Note
[[Note|alias]]
OS: Windows 10
Obsidian Version: 0.9.11
This plugin works great when a page I'm working on is one of the main pages. But if the page I'm working on is pinned to the side, it simply pastes the links. (i.e. ctrl + shift + v
acts like ctrl + v
). An image is shown below of what I mean by having the page pinned to the side.
Failed to install on Mac and iPad with latest insider releases of Obsidian.
This is a very useful plug-in. Unfortunately it does not work with Live Preview (code mirror6).
Could you add support for LP?
你好,感谢你所写的obsidian插件!我在使用过程中,发现media extended bilibili plugin这个插件,在obsidian内部 在新窗口打开视频后,只要在原始日志中切换编辑和阅读状态,就会在打开的视频窗口下面新增窗口,数量 上不封顶。新增窗口似乎和视频窗口是一体的,关闭任意一个,都会全部关掉。请问这个问题可以解决嘛?
The plugin doesn't recognize URLs if the clipboard content starts with whitespace. This might be intentional, but it would be nice if URL recognition was more lenient in this way.
Thanks for this helpful plugin: it’s especially useful on mobile to simplify creating links. I’ve added this action to my toolbar, but the icon is a question mark. Any way to make it a link icon instead?
As far as I see, this plugin checks if the clipboard contains a valid http/https URL and does not paste otherwise.
It would be nice if the plugin would also check if this is a valid file path (either POSIX or Windows) and then paste it as a link with the file URI scheme. This way you can create links to other documents or directories on your local filesystem.
It should also url encode blanks to %20 (maybe also other special characters), and in case of a Windows path, it should also convert backslashes to forward slashes.
There should be an option to use the angle bracket notation of CommonMark for links that contain spaces, instead of url encoding them. This makes the link better readable.
Also, if the clipboard content is neither a valid URL nor file path, maybe it should show an error message explaining what is wrong instead of simply doing nothing.
Maybe, if the clipboard content is a valid URI with a different scheme than http: or https: (like ftp: or mailto:) it should also be pasted. Registered and unregistered schemes (e.g. for opening certain apps) should be recognized.
Hi @denolehov,
I'm on a journey to learn typescript while developing plugins because obsidian doesn't have a lot of doc about creating plugins yet, what I'm trying to learn with the work of others, writing line by line each plugin available (locally in my machine) and documenting my learnings in obsidian :D
With your plugin, I learned to create commands with hotkeys, some of the code mirror API (like getting the cursor position and updating the selected element), and what is an active leaf and different types of leaf.
I had a question though, I tried to replicate using electron but couldn't due to an error in npm install (every time I tried :F) so I use the clipboard web API of the navigator, is there a reason why you use the electron API instead.
Would love to hear back from you, thanks for the contribution :D
this plugin is great, I find it extremely useful.
Currently the url is pasted into existing text
Would it be possible to do the reverse?
adding text to an existing url
this is due to my current situation where I have some unformulated urls in my notes
So if for instance if I have the URL https://github.com/denolehov/obsidian-url-into-selection
in obsidian there's the shortcut to format urls,
through ctrl
+k
would format it like this
[https://github.com/denolehov/obsidian-url-into-selection]()
what's I'd need is the opposite, a shortcut to
format things like this
[](https://github.com/denolehov/obsidian-url-into-selection)
I know this might be out of the scope of your plug in, but I'd love to know if your existing code would allow for such an additional option
Thanks for the great plugin again!
On the Windows GB key layout, the tilde is Shift-hash, at the extreme right of the middle keyboard row. If this extension is loaded, that key simply stops working at all.
Steps to repeat:
Expected: a tilde signe appears on screen
Actual: nothing happens on screen at all
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.