I’m currently trying to create an art blog which naturally involves a lot of images. I love using jekyll and its ability to convert markdown into html using the markdownify liquid tag.
In an effort to make my website more responsive I am also using the plugin jekyll_picture_tag. For those not familiar it uses
{%picture path/to/picture %}
and will automatically generate all the different size images and the html to set up the scrset.
What I would like to be able to do is just include an image in the blog post in normal markdown syntax, but when passed through the markdownify filter, processes it as if it is the snippet above (or semantically similar html which I can write myself) - currently, I just have to have the liquid snippet in the middle of my markdown file so I cannot preview the file by itself with all the images shown.
I’m not hugely familiar with Ruby (though can pick it up) and very much have taught my self web development for this project, but I was wandering where the markdownify (and other liquid filters) are defined so that I can go in and change the behaviour?
It is a very minor thing but yes that is what I am after and its largely so I can have a ‘pure’ markdown file that that I can preview the image in which jekyll then converts into the exact html that I want rather than having to use liquid tags that add HTML to my markdown file and then markdownifys it.
I also notice that when I use the liquid stage rather than the .md syntax the HTML that is produced wraps the image in a p tag which can also be a faff.
None of this is restrictive by any means and I can make pages how I want them using the current set up. I just wasn’t sure if there was an easy way to access what the filters do and change their behaviour and it just felt like it could have been a simple quality of life improvement for a website I hope to contribute to for some time to come.
What about doing this all over? It will keep the preview as markdown doesn’t handle capture. It just takes a few lines and is verbose. Note use of empty lines as well but you can remove them if that works.
Thanks for sharing the gist. Looks like a nice solution.
Reminder for OP that custom plugins won’t work on gh pages without GH Actions. Whether installed or added directly to plugins folder.