Created
July 13, 2021 17:42
-
-
Save harizvi/b59bf7f7c3e258ca7b0e01ad863d9480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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