04 Dec 2025
Import Markdown to Org with the Clipboard in Emacs
The preponderance of Markdown formatted text in both websites and apps is a blessing and a point of friction for Org users. The content is there, but if you’re an Org user, you really prefer the text to be formatted for Org. If you have Pandoc installed, converting from Markdown to Org is trivial but laborious as it involves making the right command invocation with temporary files.
Thankfully, Emacs can automate this conversion as described in the workflow below:
- From the source app or website, copy the Markdown into the system clipboard. This step pushes this text into the Emacs
kill-ring. - In Emacs, invoke a command which converts the above Markdown text into Org, then pastes (yanks) converted text into a desired Org file.
Note that this workflow presumes that the Emacs kill-ring is integrated with the system clipboard and that pandoc is installed.
The following Elisp command cc/yank-markdown-as-org implements the above workflow:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
This command can be invoked in numerous ways including by key binding, context menu, Transient menu, and directly via M-x. My preference is using the context menu as illustrated in the screenshot below to optimize for mouse copy/paste interactions between different apps.
Users interested in seeing how I’ve configured my context menu can read the source here. Users unfamiliar with Emacs context menus can learn more about it in my post Customizing the Emacs Context Menu.
Closing Thoughts
Implementing cc/yank-markdown-as-org turned out to be a lot more simpler than expected, as the command shell-command-on-region does the heavy lifting in abstracting away the pandoc command invocation and its handling of temporary files. This implementation can serve as a example for other conversions using the kill-ring.
A word of thanks to mekeor on IRC for reminding me that (point-min) and (point-max) exist.
Past Articles
| 24 NOV 2025 |
Announcing Casual CSVIf you need to work with CSV files in Emacs, Casual with |
| 13 NOV 2025 |
Thoughts on Funding Free Software Development“I don’t like to dream about getting paid.” read more |
| 3 NOV 2025 |
Prototyping a Toolbar UI for EdebugWhere a prototype toolbar UI for Edebug is made available for public scrutiny. read more |
| 30 OCT 2025 |
Announcing Casual EdiffWhere an earnest attempt is made to improve the usability of Ediff for sensibilities in 2025. read more |
| 25 SEP 2025 |
Storing a Link from your Web Browser to BibTeX using Org protocolAutomate writing a BibTeX Online entry to Emacs from your web browser using Org protocol. read more |
| 24 SEP 2025 |
Announcing Casual BibTeXAnnouncing Casual support for BibTeX, a bibilography database. read more |
| 8 SEP 2025 |
Announcing Numeri - an Emacs package for Roman number translationNever not know what Super Bowl it is. read more |
| 24 AUG 2025 |
A proof of concept to put a better Emacs UI on top of GnuplotWhere I demo a PoC of a Transient-based UI for Gnuplot and ask out loud, “should I go further?” read more |
| 12 AUG 2025 |
Fixing Emacs Page NavigationPage navigation in Emacs only does half of what you expect. Here’s how to fix it. read more |
Page 1 / 17 >