How to easily write in MediaWiki

MediaWiki is a very popular free and open-source wiki software that powers some of the most visited wikis on the Internet including the Wikipedia. You can also host it in your own environment for your own wiki requirements or for your organization.

At my work, we use MediaWiki for our developer’s wiki site. When I started working for a new product team sometimes back, I came to know about this wiki format for the first time and I didn’t like it very much.

I usually like to contribute to the wikis more often than not but when I first went on to add my first page to this wiki, I noticed a few annoying things:

  • We were using an older version of MediaWiki that does not come with a fancy editor. The web-based editor was pretty dull and inefficient. Also it lacked rich text highlighting.
  • The mediawiki source language was having it’s own syntax for writing rich text, sort of like markdown but not the same. And I was in no mood to learn a new set of syntax just to write a wiki page.

Then I turned towards the Internet looking for a solution. The first thing that came to my mind was to use a WYSIWYG editor that generates output in MediaWiki format instead of HTML But the thought of using a web based editor was repulsion enough for me to drive myself towards looking for a better solution.

Then I came to know about this wonderful command line utility called pandoc that can magically convert virtually any text format into another including markdown to mediawiki. This solution had at least two benefits:

  1. I was already fond of using markdown. So no learning curve for me.
  2. I could use Vim! If you know how to use Vim, you’d know that there’s no other editor that can make you more productive. And also Vim supports syntax highlighting for markdown out of the box.

Converting a markdown file to mediawiki is as simple as the below command:

pandoc -f markdown -t mediawiki -o sample_wiki.mediawiki sample_wiki.markdown

Although initially I had to go through the markdown documentation page for pandoc to learn a few tricks to ensure that my markdown texts get converted to mediawiki the way I want it to but after a day or two, it felt painless. And the best thing is that you can convert between these two text formats both ways without any distortion.

Advertisements

I am a software engineer, an open-source enthusiast and a hobbyist blogger.

Tagged with: , , ,
Posted in Blog, HowTos

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: