Skip to content

gatsby-remark-images strips imgs from gatsby-source-contentful markdown #2016

@brandonmp

Description

@brandonmp

I wired up the contentful source plugin to fetch some blog content, but it's unclear to me how to handle the post body.

I assumed I could just grab the html prop from the childMarkdownRemark field in the body, but the html therein doesn't include <img> tags. Here's an example:

// query
{
  allContentfulBlogPostBodyTextNode {
    edges {
      node {
        body
        childMarkdownRemark {
          html
        }
      }
    }
  }
}
// result
{
  "data": {
    "allContentfulBlogPostBodyTextNode": {
      "edges": [
        {
          "node": {
            "body": "Hi this is markdown \n\n[link test](https://www.google.com)\n\n![favicon](//images.contentful.com/l4pq4svxc9sb/4DZvoAxkxOKwyS6WGSIsQW/fb4225074847be1e46e655cf25283e2f/favicon.png)",
            "childMarkdownRemark": {
              "html": "<p>Hi this is markdown </p>\n<p><a href=\"https://www.google.com\">oh u want imgs here </a></p>\n<p></p>"
            }
          }
        }
      ]
    }
  }
}

Is this a bug, or si there another way to fetch the rendered html?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions