with help from another SO question on this topic, I am trying out a Showdown.js extension that is not working on html (it works fine if I want to replace just text, but I want to modify the html).
I want to change
<img src="/path/to/image/image1.jpg" alt="bloo bap" title="" />
<img src="/path/to/image/image2.jpg" alt="shoo ba doo" title="" />
to
<img class="foo" src="/path/to/image/image1.jpg" alt="bloo bap" title="" />
<img class="foo" src="/path/to/image/image2.jpg" alt="shoo ba doo" title="" />
My extension is
var demo = function(converter) {
return [
{
type : 'lang',
regex : '<img src=(.*)\/>',
replace : '<img class="foo" src=$1>'
}
];
}
var converter = new Showdown.converter({extensions: [demo]});
but no cigar.