$(document).ready(function() { // Every image referenced from a Markdown document $("article img:visible").each(function() { // Let's put a caption if there is one if($(this).attr("title")) $(this).wrap('
') .after('
'+$(this).attr("title")+'
'); }); });