Not wrapping images in p-tags?

I want to use Image Render Hooks and resulting HTML I want to use the figure tag (more or less exactly the way it’s done on the Hugo doc page), but it doesn’t make sense to use that if the image is wrapped in a p-tag which is what seem to happen on my site.

Is there some way to stop the image tag from being inside a p-tag?

There’s an issue over at Hugo’s GitHub repository raising this very question. I’ve only skimmed it, but it looks like a “won’t fix”.

It’s actually possible (thanks to Jason Becker), by adding this to the config.json file I get what I wanted

   "markup": {
      "goldmark": {
         "parser": {
            "attribute": {
               "block": true
            },
            "wrapStandAloneImageWithinParagraph": false
         }
      }

1 Like