Jump to content
amahabal

Feature Suggestion: Get Clipboard HTML

Recommended Posts

I was trying to write a pandoc based flow to write my gmail messages in markdown, press a key, and have them transformed into richer layout.

 

The problem: the ⌘C in gmail captures HTML, but what I could get from the Alfred clipboard was the text, which stripped out newlines (well, they were NOT newlines but <div></div> tags and what reached me was the text). To test this, in a gmail tab, type A, B, C, one per line, copy it, and paste it on to the command line in a Terminal: we get "ABC", all on one line. If you paste it into gmail, though, we get the original back. Alfred just seems to behave like the terminal.

 

I worked around this by using the Python module https://pypi.org/project/richxerox/ (which allows access to the clipboard's HTML, Rich text, or Text), but it would be far more convenient if Alfred could somehow make that available when we specify for a HotKey "selection in macOS".

 

Or maybe it is available, and someone will tell me how to use it :)

 

Thanks!

  Abhijit

Share this post


Link to post
5 hours ago, amahabal said:

Alfred just seems to behave like the terminal.

 

Yes. The clipboard can hold multiple representations at the same time, but Alfred can only pass one to your workflow script. HTML is rare (only browsers put it on the clipboard), and RTF isn't much use in scripts (textutil's RTF -> HTML conversion is crap), so I'm not sure there's much benefit in Alfred supporting alternative, non-plaintext formats.

 

It’s also only a few lines of code to get the representation that you want.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...