emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: torys.anderson@gmail.com (Tory S. Anderson)
To: Albert Krewinkel <tarleb@moltkeplatz.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Preserve formatting when copy/pasting from HTML
Date: Fri, 23 May 2014 13:31:51 -0400	[thread overview]
Message-ID: <878upsz9iw.fsf@gmail.com> (raw)
In-Reply-To: <87ha4jjpz6.fsf@caffelatte.moltkeplatz.de> (Albert Krewinkel's message of "Wed, 21 May 2014 14:06:21 +0200")

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 <tarleb@moltkeplatz.de> 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/

  reply	other threads:[~2014-05-23 17:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 10:47 Preserve formatting when copy/pasting from HTML Tory S. Anderson
2014-05-21 12:04 ` Bastien
2014-05-21 12:06 ` Albert Krewinkel
2014-05-23 17:31   ` Tory S. Anderson [this message]
2014-05-21 18:52 ` Ilya Shlyakhter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878upsz9iw.fsf@gmail.com \
    --to=torys.anderson@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tarleb@moltkeplatz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).