Word in Discord app is highlighted; my URL is already in clipboard; how to turn it into a link

Discord uses Markdown syntax to make links:

Suppose I have the url I want already in the clipboard

Screenshot 2023-11-07 at 16.59.35

i tried this and it works, but i'm not sure if I'm using "named clipboards" correctly:

in step 2 i didn't name the clipboard (am i supposed to do that?)

Have I now stored this clipboard [in this case some text] forever on my Mac?

  • I don't want to clutter up my Mac with info I don't need anymore.
  • Should I be using "trigger clipboard" instead? (I've tried reading the wiki but I don't really understand it)

Your attempt is valiant, but there are some problems. For example, you created a named clipboard with a name that wasn't a real name, but instead was a URL. And then you said "you didn't name the clipboard." Yes you did name it, you just gave it an inappropriate name. You should probably delete that named clipboard, and use my solution instead.

Here's my solution. What I did was stored the current clipboard into an extra clipboard. That way when we press Cut, it's okay that the system clipboard gets overwritten. Then we have two clipboards with the correct data and we paste that into the document.

At the end of your code you seem to be trying to restore what was in the original system clipboard, I think, but you didn't mention that in your original description of the problem, so I didn't put that into my solution. It's not a necessary step based on your description of the problem.

I wrote a link tool to do things just like that:

In mine, if you have text selected and a URL on the clipboard, it will paste it as a HTML link. You'd need to modify the macro to write it in markdown form, but it shouldn't be too tricky to do that.