php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

add class to all image links?

Open morrow95 opened this issue 8 years ago • 2 comments

Currently images are converted to :

<img alt="description" src="http://www.example.com/example.png">

Is there any way to add a class to all img tags so it would become :

<img class="img-responsive" alt="description" src="http://www.example.com/example.png">

I am modifying someone else's code, but all they are doing it using this line :

$result = MarkdownExtra::defaultTransform($original);

morrow95 avatar Sep 18 '15 05:09 morrow95

After the Markdown-to-HTML conversion, do this:

$result = str_replace('<img ', '<img class="img-responsive" ', $result);

michelf avatar Sep 18 '15 10:09 michelf

So there is nothing built into markdown then... all I needed to know, thanks.

morrow95 avatar Sep 18 '15 14:09 morrow95