Since my switch to Middleman I’ve been using Redcarpet as Markdown engine. The rendering engine itself ran fine but sadly doesn’t offer a way to specify custom classes for elements - a shame when you’re looking for a way to declare a certain image as img-responsive for Bootstrap et cetera.

Middleman gladly supports a variety of engines (including kramdown) and I figured it might be worth switching in order to obtain that extra bit of flexibility. kramdown comes with a non-standard syntax for CSS-classes:

1
2
3
![an-image-description](someimage.png){: .img-responsive }
![another-image-description](anotherimage.png){: .img-responsive .round }
![an-image-with-id](imagewithid.png){: #banner .img-responsive }

When you’re looking into switching your Markdown engine you’ll have to set the following line in your config.rb:

1
set :markdown_engine, :kramdown

Another engine that allows using custom CSS-classes via attribute lists is Maruku. Feature-wise it looks quite similar to kramdown but there has been little activity in it’s GitHub repository.

I hope this short post helps a few of you,
Tim

comments powered by Disqus