Registered Member
|
If I copy HTML content to the KDE clipboard, I can paste it into an HTML-aware editor and it retains the HTML formatting. That's expected behavior. And I need a command line method of doing the same (or similar). Or I need a way to create an action/command in Klipper to accomplish the goal.
Here is the first (non-working) solution I tried so far:
It saves the HTML contents as plain text. Next I used "Action Options" (section 3.3 of Klipper handbook).
That also saves the HTML contents as plain text. I need a command that will let me save the HTML as HTML source. For example, say I hightlight and copy some content from a web page about running ("The Couch to 5k Plan"), I want the file I save to contain that HTML like this:
That's what I want. Instead, what I get with either of the two methods above is this:
That's not what I want. |
Administrator
|
Unusual. I just copied a basic HTML fragment and it was output without alteration by both these commands:
Which application are you copying the HTML code from?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
I don't see any difference in the two commands you listed. I did not say I was copying HTML code. I am copying HTML content from the browser. I just highlight a section of text (may or may not include images, links, etc.). Then I use CTRL-C to copy it to the clipboard. |
Registered Member
|
Here's the best solution I have so far. But it doesn't use Klipper. I'm still looking for a Klipper solution.
http://unix.stackexchange.com/a/78416/15010 Answer With a recent version of [`xclip`](http://xclip.sourceforge.net) (the `-t` option [was added in 2010](http://sourceforge.net/p/xclip/code/81/) but not released yet AFAICT, so you'd need to get it from subversion, or use the one packaged in Debian).
And if you want to make that back into the clipboard:
Which you can do in a loop with:
The second `xclip`, with `-quiet` will block until something else claims the CLIPBOARD selection, that is until you select something else somewhere. That way, you can copy back and forth between your browser and whatever you're pasting the markdown in. Answered by [Stephane Chazelas](http://unix.stackexchange.com/users/225 ... e-chazelas) |
Administrator
|
Oops. What I had meant to post was:
I can confirm the issue you mentioned. Unfortunately it can't be easily solved unless Klipper adds support for explicitly requesting a certain mimetype - which is what the xclip command above does. Klipper likely defaults to text/plain, rather than text/html which is what you need in this case.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]