I am trying to convert a text from markdown to rendered RTF in a shell script and wrap the command in an Apple Automator Service.
I realized that the only way to achieve the task is by doing:
python -m markdown | textutil -convert rtf -format html -stdin -stdout -font Helvetica -inputencoding UTF-8 | pbcopy | pbpaste -Prefer rtf
Question:
- How to avoid using the clipboard to interpret RTF?
- Is there another application to use instead of
pbcopy
pbpaste
?
Cmd explain:
python -m markdown
does the main worktextutil [… opts]
converts from HTML to RTFpbcopy | pbpaste -Prefer rtf
does the magic interpreting plain-text RTF directives out fromtextutil
and returning as interpreted RTF.
The issue would be far easier if RTF were not requested to be interpreted. I already tried to call the first two steps of the pipe and able to save rtf-formatted files (and other formats as well) correctly.