Vim, Pandoc, and Happiness


Some days I take Vim’s power for granted.

Today isn’t one of those days.

I just got done migrating all of my content from shoddily-marked-up “static” PHP and HTML files into my CMS, and the cleanup has begun.

The problem is that I’ve been writing articles and posts in various editors and formats (with varying code quality) for about a decade and a half.

And now all of those are sitting in my CMS being crufty.

Markdown to the rescue

I decided when I started this migration that I’m going to standardize on Markdown. I’ve been in love with the language for years now. It’s simple. It’s elegant. It’s powerful. It’s functional.

It’s Markdown.

Damn, that sounded like a commercial.

Anyway, I now have a couple hundred posts in horrific HTML that need to get converted. Sounds like a stick in the eye.

But not with Vim + Pandoc. Pandoc is a program that converts content from one format to another, and it supports a lot of formats.

Well, using Vim (with Pandoc installed) I can make short work of my old posts. I simply select some portion of the document and then hit:


Bam! Perfectly formatted Markdown. Oh, and if I want to create clean HTML from that markdown I can just run the opposite and it’ll do that as well.

This makes me far happier than it should.

Related posts: