Created
June 2, 2021 20:30
-
-
Save mxpiotrowski/96a531c3e3aabd648ac773f0586387f4 to your computer and use it in GitHub Desktop.
Convert region to RTF (using pandoc) and copy to macOS clipboard.
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
(defun mxp-copy-as-rich-text (start end) | |
"Convert region to RTF (using pandoc) and copy to macOS clipboard. | |
Input format is “org” or “markdown” depending on the buffer's major mode." | |
(interactive "r") | |
(let ((coding-system-for-read 'utf-8) | |
(coding-system-for-write 'utf-8) | |
(src (cond ((eq major-mode 'org-mode) "org") | |
(t "markdown")))) | |
(shell-command-on-region start end | |
(concat "pandoc -s -f " src | |
" -t rtf -o - - | pbcopy" )))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment