Markup Conversion

I have been using an Obsidian plugin for NeoVim for note taking, particularly at work. Today and ran into a situation where I wanted to copy some of my notes and paste them into a meeting invite. Since my notes are in Markdown I was either going to have to open them in the actual Obsidian app and figure out how to copy them as rich text from there or find a different solution.

Google led me to a StackOverflow post about using the pandoc CLI utility to convert the Markdown content to Rich Text Format (RTF). So I tried this but I ran into an issue with the what ended up in my clipboard. When I pasted the result into the meeting invite I got a raw ascii representation of the RTF content.

Another Google search found a blog post attempting to accomplish the same things but using pandoc in a slightly different way. It turned out the key to making things work as I intended was that I needed to use the --standalone flag in pandoc. This resulted in the content in my clipboard having the format I wanted.

pbpaste | pandoc --standalone --from markdown --to rtf - | pbcopy

Another note here is that because I was using Outlook (not by choice) to send the invite I needed to use the “Keep Source Formatting” paste option otherwise it would immediately change what I pasted to some other format that wasn’t at all what I wanted.

The next step will be to create a key binding in NeoVim so that I can select content in visual mode then transform it directly into the clipboard registry in one key combination.