How do I NOT escape special characters from the {{clipbboard}}? #224
-
When I have a path name on the clipboard, all the slashes and spaces get escaped by a backslash like this: I am trying to form a URL from this (maybe there is already a plugin for file URLs?) but I can't because of the slashes here, makes it way harder. I just want to put angle brackets around the pathname and it would work with spaces. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 18 replies
-
I have learned that I can achieve what I want with option-click-drag of a file to a document. However, I have hit this problem before in other contexts, so I'd still like to know how to escape the escapes! Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi! If you really want to use unescaped values, add an exclamation mark May I ask about what is the precise shell command where the escaping causes problems? I'm interested to learn use-cases that are new to me. Usually I'd say that unescaped values can be dangerous to use, but I don't know the situation here. The backslashes should be removed by the shell, at least if you don't wrap the There's still one problem left: Currently the Shell commands plugin does not offer a way to do URL encoding, so some special characters (such as spaces) in the clipboard content may break your URL. I'm trying to come up with some kind of url encoding plan here. Maybe you can use some shell command to do URL encoding. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the trick! I will certainly use ! for my little hacks going forward. And the documentation link is very helpful. As for a use case, when I use the command |
Beta Was this translation helpful? Give feedback.
-
I moved this conversation from Ideas to Q & A. |
Beta Was this translation helpful? Give feedback.
Hi! If you really want to use unescaped values, add an exclamation mark
!
to the variable:{{!clipboard}}
. In case you want to read more about escaping, there's a small documentation page for it: https://publish.obsidian.md/shellcommands/Variables/Escaping+special+characters+in+variable+valuesMay I ask about what is the precise shell command where the escaping causes problems? I'm interested to learn use-cases that are new to me. Usually I'd say that unescaped values can be dangerous to use, but I don't know the situation here. The backslashes should be removed by the shell, at least if you don't wrap the
{{clipboard}}
variable in quotes (when your shell is Bash/Dash/Zsh. For PowerShell,…