Skip to content

Instantly share code, notes, and snippets.

@joshua-koehler
Last active September 14, 2024 15:45
Show Gist options
  • Select an option

  • Save joshua-koehler/769c405cc117653ae19aa51495348e94 to your computer and use it in GitHub Desktop.

Select an option

Save joshua-koehler/769c405cc117653ae19aa51495348e94 to your computer and use it in GitHub Desktop.
Copy Markdown from stdin to clipboard in RTF format - OSX
alias mdcopy="pandoc --from markdown --to html | textutil -convert rtf -stdin -stdout -format html | sed -e \"s/..e2..80..99/'/g\" | pbcopy -Prefer rtf"
@joshua-koehler
Copy link
Author

The sed command is necessary to fix textutils incorrect copying of apostrophes from html textContent.
Perhaps if the apostrophes were html encoded in the pandoc conversion as ’ then this wouldn't be an issue downstream in textutil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment