Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
;; discussion in reddit about clipping from browser.
(defun hr/paste-html-to-org ()
"Takes the contents of the system clip/paste-board, and uses
`pandoc' to convert it to the org-mode format."
(interactive)
(let* ((clip (if (eq system-type 'darwin)
"pbv public.html"
"xclip -out -selection 'clipboard' -t text/html"))
(format (if (eq major-mode 'org-mode) "org" "markdown"))
(pandoc (concat "pandoc -f html -t " format))
(cmd (concat clip " | " pandoc))
(text (shell-command-to-string cmd)))
(kill-new text)
(yank)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment