From mboxrd@z Thu Jan 1 00:00:00 1970 From: torys.anderson@gmail.com (Tory S. Anderson) Subject: Re: Preserve formatting when copy/pasting from HTML Date: Fri, 23 May 2014 13:31:51 -0400 Message-ID: <878upsz9iw.fsf@gmail.com> References: <87tx8j9zo5.fsf@gmail.com> <87ha4jjpz6.fsf@caffelatte.moltkeplatz.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WntK0-0001eh-42 for emacs-orgmode@gnu.org; Fri, 23 May 2014 13:31:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WntJy-0003gf-TV for emacs-orgmode@gnu.org; Fri, 23 May 2014 13:31:56 -0400 Received: from mail-yh0-x22d.google.com ([2607:f8b0:4002:c01::22d]:47447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WntJy-0003gF-Oc for emacs-orgmode@gnu.org; Fri, 23 May 2014 13:31:54 -0400 Received: by mail-yh0-f45.google.com with SMTP id b6so4508095yha.18 for ; Fri, 23 May 2014 10:31:53 -0700 (PDT) In-Reply-To: <87ha4jjpz6.fsf@caffelatte.moltkeplatz.de> (Albert Krewinkel's message of "Wed, 21 May 2014 14:06:21 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Albert Krewinkel Cc: emacs-orgmode@gnu.org 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 writes: > torys.anderson@gmail.com (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/