cedricdelpoux/gatsby-remark-unwrap-images

Not working with `gatsby-remark-image`

snirp opened this issue · 2 comments

snirp commented

Gatsby-remark-image wraps images in the following way:

<p>
    <a class="gatsby-resp-image-link">  <!-- this one you can disable -->
        <span class="gatsby-resp-image-wrapper">
            <span class="gatsby-resp-image-background-image"></span>
            <img class="gatsby-resp-image-image">
...

Even when you disable LinkImagesToOriginal, it still doesn't work because the span is there.

snirp commented

It does work now. Make sure to:

  • Add gatsby-remark-unwrap-images before `gatsby-remark-image
  • Not to done something like: ![image](img.png)*Caption text here*

The second point results in the paragraph containing another node (rendered as <em>) and gatsby-remark-unwrap-images no longer being able to remove the paragraph.

Hi there,
I am experiencing the same problem. Even when I place the 'gatsby-remark-unwrap-images' before 'gatsby-remark-images' inside the plugins array of 'gatsby-transformer-remark' it still seems to not work because of the reason described in the original comment - that is, while it does remove the p element, there still exists a span element as a parent to the img