A universal document converter -- Pandoc
Pandoc is a universal document conversion tool and it is a free. You can install it and use it as a command tool, you can also use it online.
It can be used to convert between many document formats, some of them are:
Examples to convert documents with Pandoc
Convert word to markdown
# -s, standalone
# -f, input file format
# -t, out file format
# -o, output file name
$ pandoc -s -t markdown exampledocx -o example.md
Convert word with images to markdown
If there are images in the word document, you can use --extract-media
option to extract them to a folder and they will be referenced automatically in the output markdown file.
# The images extrated will be put in the 'media' child folder.
$ pandoc -f docx -t markdown --extract-media="." example.docx -o example.md
Convert markdown to word
If the markdown references images, they will be displayed properly in the docx file.
$ pandoc example.md -o example.docx
To make the output docs to include toc (table of document), use --toc
option.
$ pandoc example.md --toc -o example.docx
More about Pandoc
According to Pandoc’s official site:
There are many ways to customize Pandoc to fit your needs, including a template system and a powerful system for writing filters.
Pandoc includes a Haskell library and a standalone command-line program. The library includes separate modules for each input and output format, so adding a new input or output format just requires adding a new module.