Copy Markdown as rich text and plain unmarked text

A macro which copies selected markdown to the clipboard in two forms:

  • Rich text (used when pasting into Rich Text editors and fields)
  • Plain text without the MD markup (used when pasting into text editors)

Copy Markdown as Rich (and unformatted plain) Text.kmmacros (24 KB)

5 Likes

Just as an FYI…

On M1-based Macs, Homebrew no longer installs to /usr/local/ but to /opt/homebrew/

So if you wanted to use this on an M1-based Mac that had installed multimarkdown via brew you would need to change all references of

/usr/local/bin/multimarkdown

to

/opt/homebrew/bin/multimarkdown

I've also mentioned this to Brett Terpstra, because some of his Markdown tools also assume /usr/local/bin/ as the only install location -- which made sense until very recently.

3 Likes

@ComplexPoint Thank you! Downloaded. :+1: .

Thanks for sharing!

Currently using this removes all line breaks. Is it possible to keep line breaks? Thanks

line breaks

That's essentially a feature of Markdown, which assumes that:

  • paragraphs will be separated be a pair of linefeeds (one whole blank line)
  • single linefeeds are just end of line (not end of para) and are to be discarded.

See, for example, the Paragraphs section of:

Basic Syntax | Markdown Guide


If that's not how you're working, then you may need a preceding script (or Keyboard Maestro action) which replaces \n with \n\n.

@ComplexPoint Hey there, I could use a hand. I'm on a M1 MacBook Pro so I've swapped the file paths in the 2 places appropriately. I've started to draft my emails in Obsidian Markdown and wanted to be able to copy from Obsidian and paste as rich text in macOS Outlook. I've got it on a Hyper+V trigger. Trouble is, it seems to work inconsistently. Most of the time nothing happens, and then sometimes it will paste. The times that it has pasted I've noticed that it took quite a bit of time.

Can it really take that long to do the text transformation for pasting? Any ideas or suggestions would be appreciated, thank you!