emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Preserve formatting when copy/pasting from HTML


From: Tory S. Anderson
Subject: Re: [O] Preserve formatting when copy/pasting from HTML
Date: Fri, 23 May 2014 13:31:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

I'm thoroughly impressed by pandoc. Quite the magnificent program! Using pandoc 
and xclip I was able to do what I wanted. As you mentioned, I am able to copy 
from, say, a wikipedia page, and paste as (mostly) properly formatted org code. 
My code is: 

while :; do
  xclip -o -selection clipboard -t text/html |
    pandoc -r html -w org |
    xclip -i -selection clipboard -quiet
done

Thanks!
- Tory

Albert Krewinkel <address@hidden> writes:

> address@hidden (Tory S. Anderson) writes:
>
>> We often read online articles with headings and sometimes subheadings. They
>> may also include bold, italic, and hyperlinks, all of which are supported by
>> Org. Is there any way to preserve this formatting if I copy-paste into
>> org/emacs, the same way it's preserved when I paste into Word or into a 
>> Google
>> Document/email? Or is this fundamentally difficult in emacs? It would be a
>> tremendous feature.
>
> A suggestion for a workaround: You might get decent results using
> Pandoc[1] and pandoc-mode[2].  Pandoc can parse HTML and convert it to
> org-mode markup.  There is also a helpful answer on stackexchange[3]
> (just replace "markdown" with "org).  You might be able to use the above
> tools to integrate the mentioned techniques into org's capture mechanism.
>
> HTH,
> Albert
>
> [1] http://johnmacfarlane.net/pandoc
> [2] https://github.com/joostkremers/pandoc-mode
> [3] http://unix.stackexchange.com/questions/78395/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]