Hello,
I’m trying to do the following:
I want every image included inline in an blog post to have a specific CSS class added.
Here is an example:
The blog post source
I have a 2015-04-23-de-ce-eu.html.markdown file.
Inside that file I wrote the following line:
![my-image](2015-04-23-de-ce-eu/de-ce-eu-header.png)
The generated page source (actual result)
The above line generates the following HTML:
<img alt="my-image" src="/articole/2015/de-ce-eu/de-ce-eu-header.png">
The expected result
What I would to achieve is to generate the following HTML:
<img alt="my-image" src="/articole/2015/de-ce-eu/de-ce-eu-header.png" class="responsive-image">
I couldn’t find any documentation about how to make this happen for an img tag inside a blog post written in markdown.
So far I’ve generated the following possible workarounds:
- Not using markdown for writing blog posts and write HTML and ERB.
- Adding a JavaScript code which automatically adds that class to every img tag in the page
I still think there is a more elegant solution then those two.
For example I found on the internet an example of a helper which automatically adds a class to body tag.
Thank you,
L