Customize `img` rendering using Markdown Render Hooks

I did a full rebuild, but it looks like it still isn’t working. :frowning:

Okay, we will continue the investigation. :blush: What about the logs, are they all good? No errors or warnings during the rebuild?

Also, this might come off as a bit of a “have you tried turning it off and on again” kind of question, but just to be on the safe side I’m asking it anyway: are you using Markdown syntax in your blog posts? Like this:

![](https://qrk.social/uploads/2023/840da10dce.jpg)

I am, but weirdly I just went to edit my latest post with an image attached, to show you and the image is embedded with HTML:

Lovely walk in the wood behind our house this evening.

<img src="https://qrk.social/uploads/2023/b7a4ee8682.jpg" width="600" height="450" alt="">

I did, definitely, one million percent use markdown. Pinky promise. :blush:

Okay, if you change it to Markdown syntax, does your custom Markdown Render Hook apply then?

:tada: YES! That’s it! Here’s what I see now:

<img src="https://micro.blog/photos/600x/https%3A%2F%2Fcdn.uploads.micro.blog%2F102448%2F2023%2Fb7a4ee8682.jpg" alt="">

It’s down from a couple MB to ~120KB…this is perfect!

Question now is, why is it inserting the images as HTML when I post via the WebUI or the app? I created a couple of test posts, one from the WebUI and other from the iOS app. Both times it parsed the images as HTML in the posts:

<!-- From WebUI -->
<img src="https://qrk.social/uploads/2023/de2a46ba89.jpg" width="600" height="450" alt="">

<!-- From iOS app -->
<img src="https://qrk.social/uploads/2023/4d2ded0215.jpg" width="600" height="600" alt="">

If I then edit the post source to be markdown, it work as expected.

It’s just a design decision by @manton. Other Micro.blog/Micropub/MetaWeblog clients might insert Markdown instead or let you choose. Gluon, for example, uses Markdown when you inline an image.

Whichever app you use, you always have the option to write Markdown manually.