Converting a Markdown Region to Org Revisited
10 Jan 2025 Charles Choi
On more than one occasion I’ve found myself needing to convert Markdown formatted text to Org using this workflow:
- Copy Markdown formatted text (usually from a web browser) into the kill ring.
- Paste above text into an Org buffer.
- Manually reformat said text to Org.
Folks who have pandoc
installed can automate step 3 above with the Elisp function quoted below from the Stack Exchange post “Convert region/subtree from Markdown to org”.
1 2 3 4 |
|
So just copy the above function into your config and call it a day, no?
Not quite. If left unspecified, pandoc
will automatically wrap long lines 😞. I prefer keeping a paragraph as a single long line in Org.
To keep a paragraph as a long line, use the pandoc
argument --wrap=preserve
.
Listed below is an amended version of the above routine.
1 2 3 4 5 6 7 8 9 |
|
Regardless of your preference, if this is news to you and seems useful, give it a try.