Is there a way to control markdown images in Hugo?

This can’t be done in Hugo natively -at least not entirely-. I very much doubt that filling a Github issue would make much of a difference since there are other priorities.

BUT

I managed to wrap a markdown image with the markup I need, by modifying line 824 of pen.js Pen - What You See Is What You Get (WYSIWYG)

from

img: [/<img\b[^>]*src=["']([^\"+|[^']+)[^>]*>/ig, '![]($1)']

to

img: [/<img\b[^>]*src=["']([^\"+|[^']+)[^>]*>/ig, '{{% wrap %}}![]($1){{% /wrap %}}']

It’s very simple really. I just wrapped the markdown image inside a Hugo shortcode that uses markdown {{% wrap %}} so that on markdown export I get what I need!

Profit! :sunglasses:

Who needs a CMS with PHP etc when one can do his job with a simple WYSIWYG frontend like Pen.

Now on to the next challenge! :beers:

1 Like