如何在UNIX / OSX命令行上将RTF转换为Markdown,类似于pandoc

问题描述 投票:12回答:2

如何在UNIX / OSX下使用命令行工具将RTF(例如从stdin)转换为Markdown。

我正在寻找像pandoc这样的东西。但是pandoc本身不允许RTF作为输入格式。 :-(所以,我很高兴使用pandoc的类似工具或pandoc的外部RTF阅读器指针。

macos unix converter markdown rtf
2个回答
13
投票

在Mac OSX上,我可以使用预安装的textutil命令进行RTF到HTML的转换,然后通过pandoc转换为markdown。因此从stdin获取RTF并将markdown写入stdout的命令行如下所示:

textutil -stdin -convert html  -stdout | pandoc --from=html --to=markdown

3
投票

一起使用Tedpandoc,您应该能够这样做:

Ted --saveTo text.rtf text.html
pandoc --from=html --to=markdown --out=text.md < text.html
© www.soinside.com 2019 - 2024. All rights reserved.