Convert Markdown to MediaWiki with Pandoc

Takashi Yoshida bio photo By Takashi Yoshida

Our project team uses MediaWiki to capture and share knowledge among our team members. While I like MediaWiki in general, I never liked its syntax enough to learn it well.

Instead, I find myself writing an entire article in Markdown without realizing it until the article is nearly complete. The article does not appear how I intended and I spend more time fixing incorrect syntax.

Rather than learn MediaWiki syntax, I wanted to write an article in Markdown and automagically convert it in MediaWiki format. After a quick search, I found out that Pandoc is exactly what I needed.

Installation is very easy on all major platforms (Linux, OS X and Windows). On OS X, it takes a very long time to build ghc if you are installing Pandoc via Homebrew. You will need to give yourself several hours.

Once the installation is done, you can convert your Markdown file to MediaWiki format like this:

pandoc -f markdown -t mediawiki -o example.wiki example.md

This will be enough to make me happy to capture and share knowledge for the time being. It is also possible to generate Microsoft Word file from Markdown. Pandoc might make documentation work tolerable enough, if I can use Markdown mostly.