From Markdown To Pastable Formatted Text In OS X Terminal

By Tuesday, August 4, 2015 0 , , Permalink 3

I use Markdown a lot. I use it right now, to compose this post 🙂 . It’s my go-to syntax for quick plain text files for notes and such. It’s what I use when I code something that outputs “formatted” text to terminal.

Recently, I wanted to take Markdown output from a script I wrote, and send a nicely formatted version of it by email.

Read on for the solution I eventually came up with, after several iterations, and essential tips from Brett Terpstra, the Markdown Master.

tl;dr:

cat foo.md | \
  pandoc --from markdown --to html | \
  textutil -convert rtf -stdin -stdout -format html | \
  pbcopy -Prefer rtf

Continue Reading…