Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert RTF to Markdown on the UNIX/OSX command line similar to pandoc

Tags:

How do I convert RTF (say from stdin) to Markdown with a command line tool under UNIX/OSX.

I am looking for something like pandoc. However pandoc itself does not allow RTF as an input format. :-( So, I'd be happy either with a similar tool to pandoc or a pointer to an external RTF reader for pandoc.

like image 440
halloleo Avatar asked May 26 '15 01:05

halloleo


People also ask

Can Pandoc convert HTML to markdown?

Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.

Is Pandoc open source?

Pandoc is open-source software used to transform various filetypes such as . md into more user-friendly filetypes including . pdf , . docx , and .


2 Answers

On Mac OSX I can use the pre-installed textutil command for the RTF-to-HTML conversion, then convert via pandoc to markdown. So a command line which takes RTF from stdin and writes markdown to stdout looks like this:

textutil -stdin -convert html  -stdout | pandoc --from=html --to=markdown
like image 136
halloleo Avatar answered Sep 21 '22 18:09

halloleo


Using Ted and pandoc together, you should be able to do this:

Ted --saveTo text.rtf text.html
pandoc --from=html --to=markdown --out=text.md < text.html
like image 20
miken32 Avatar answered Sep 20 '22 18:09

miken32