Jump to content

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

Link to comment
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.

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...