How to copy/paste browser text which includes links + preserve them?

Hey and good day,

I'm afraid this is too difficult, in which case we should leave it as is now (ie. only plain text is pasted - %SystemClipboard%.

The plan is to preserve the LINKS when copying/ pasting into .rtf or .pages .

There is something related here from 2015, maybe there are more recent solutions?

Copy selected link(s) from browser as markdown?

with best regards,
Omar KN, Stockholm, Sweden

Not sure that the context or problem are very clear here.

If, for example, you:

  1. select the text of a Wikipedia page,
  2. copy, and
  3. paste into TextEdit

don't you find that the links are preserved ?

(I do here – both with keyboard ⌘C, ⌘V, and with Keyboard Maestro Copy and Paste actions )

Yes, of course.

But if I use this simple macro, only plain text is inserted:

Screenshot 2024-07-01 at 13.46.54.jpg

(I don’t really need the HYPER URL from the %FrontBrowserURL%)

but really the included link(s) in the text from the %SystemClipboard%,


I have to agree with @ComplexPoint. It's not clear what you are trying to do, but please spell it out and I'm sure someone will be able to help.

Pasting your post into Apple Pages preserves the link you included. If that page is then exported to .rtf, the link is preserved.

The forum thread you linked to might (perhaps – I would like to know its relevance before I read it all!) suggest that you want to save any links as Markdown. If that is the case, you will have to paste into an application that supports Markdown, rather than Pages.

Oh, right... This does not answer your question but I see what you mean.

I made a test macro which included an Insert Text by Pasting action which used the %SystemClipboard% token. The URL was not in the pasted text when the macro was run, and the URL was stripped from the clipboard. Using Insert Styled Text by Pasting instead fixed that.

1 Like

To summarize the clipboard behaviour of those two Keyboard Maestro actions:

  • Insert Text by Pasting creates and pastes from a public.utf8-plain-text NSPasteboard item.
  • Insert Styled Text by Pasting creates and pastes from a public.rtf NSPasteboard item.

As @kevinb points out, it's a public.rtf pasteboard item that you need here.

If you simply use a Keyboard Maestro Paste action when the clipboard contains (as it usually does) NSPasteboard items of various types, then the receiving application will make the choice of which NSPasteboard item to use.

When we copy from a page like this, using Safari, for example, Safari populates the clipboard with pasteboard items of the following types:

  • public.rtf
  • public.html
  • public.utf8-plain-text

which gives applications like TextEdit and Pages plenty to choose from.

NSPasteboard | Apple Developer Documentation


Using ”Insert Styled Text by Pasting” works like a charm -

[Now for the correct styling I open a new post (How to style the clipboard then insert all of the text?),

Thank you everyone for helping!]