如何将 word 文件转换为 markdown 文件

本文主要介绍在Ubuntu系统下面如何将 word 文件转换为 markdown 文件。
第一步:安装 unoconv 和 pandoc


sudo apt-get install unoconv pandoc
第二步:将 word 文件转换 html


unoconv -f html -o file.html file.docx
-f html:指定我们要转为 html 格式(format)
-o file.html:表示输出(output)的文件名为 file.html
file.docx:表示要转换的文件为 file.docx
第三步:将 html 转换为 markdown


pandoc -f html -t markdown -o file.md file.html
-f html:指定我们要从什么文件(from)转换
-t markdown:指定我们要转为 markdown 格式(to)
-o file.md:表示输出(output)的文件名为 file.md
file.html:表示要转换的文件为 file.html
第四步:将图片拷贝到 images 中


     转换出来后会有很多图片,需要将图片拷贝到 images 文件夹中, 然后再单独上传images中的文件到博客中,这样就可以把我们 Word文档分享到博客了,比如CSDN博客。




     本博客转载自 http://wenzhixin.net.cn/2014/01/03/convert_word_to_markdown,笔者针对以上方法进行了测试,实际的项目中也在使用,对原作者表示由衷的感谢。

猜你喜欢

转载自blog.csdn.net/u011037149/article/details/51110928