Add CSS Classes to Images with Markdown in Drupal

Markdown

For some time I’ve been writing my blog posts here in Markdown and using the Markdown input filter module to process the text in Drupal. Recently, as I found myself updating some older posts, I needed to be able to add classes to links and images and wondered if there was some way to specify these in Markdown.

The Markdown module uses PHP Markdown Extra as its Markdown processor, which is currently at version 1.2.7 and does support special attributes like classes. Unfortunately, the module currently ships with version 1.2.5, without that support.

However, to enable special attribute support (along with whatever other features and bug fixes have been added since 1.2.5), simply download the latest version, extract markdown.php, and place it in your markdown module folder–overwriting the existing file.