Jump to content

How to format a link (text + URL) so that it does not paste with an extra new line at the end

Recommended Posts

Proverbially pulling my hair on this one: With a URL in the clipboard, I want an Alfred Workflow that pastes a link in Google Docs. More specifically, I want a static text to be used as the ~"body", the text should be clickable and clicking on it should open the URL. A basic link. I created a workflow that uses rich text formatting. And it works but when pasting in Google Docs, it adds a new line at the end. It could be that this is the way Google Docs treats incoming rich text from the clipboard. So, I'm wondering if I shouldn't use HTML instead. But I don't know how to make it so that Alfred pastes a link, not raw HTML.

When I copy a link from a webpage, and paste it into Google Docs, it does not add a new line. 

What are my next steps here? How can I make this work?






$ cat snippet1.rtf
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}

\f0\fs29 \cf0 [{\field{\*\fldinst{HYPERLINK "URL_TO_REPLACE"}}{\fldrslt Asana}}]}%

What other elements would you need to help me break through?


Thanks a million in advance. Long time user, first time poster :) Love Alfred and the community. Thanks for all your workflows, people!!

Link to comment
26 minutes ago, giovanni said:

Hi @Pierre,

Welcome! Have you tried to interpose (before pasting) a Replace utility replacing /n  with nothing, or space? 




Thank you!

I just tried this and, unfortunately, the problem persists. It's as if Google Docs reads the clipboard, perceives an indication of "rich text" and adds a new line no matter what.

Edited by Pierre
Link to comment
13 minutes ago, giovanni said:

what about adding a backspace



It deletes the whole thing, not just the last character for some reason.

Thanks, though.


What about placing something other than rich text in the clipboard?

Link to comment

Wow, thank you so much for putting this together. This is incredible.

However, it still adds a new line after pasting 🥺

Does it not for you when you use it with google docs? The problem isn't with my google account, I tried two. Does this occur when you try it?

The problem does not occur in Pages nor TextEdit... Could it be a Google Docs idiosyncratic thing?

Link to comment

you are right @Pierre it still adds a new line. I must have tried it in Word. Adding a 0.1-second delay before backspace works for me (it should work on your own version as well), but not obviously with the universal action. It's hacky but gets you what you want...

Edited by giovanni
Link to comment
On 2/11/2022 at 9:24 PM, Pierre said:


It deletes the whole thing, not just the last character for some reason.

The app may be registering that you still have your finger on CMD and be executing CMD+Backspace instead of just Backspace.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...