Skip to content

Commit

Permalink
Fix images disappearing from rendered markdown files (gatsbyjs#3612)
Browse files Browse the repository at this point in the history
* Fix images disappearing from rendered markdown files

Fixes gatsbyjs#3608

* Revert invalid indentation changes
  • Loading branch information
kripod authored and jastack committed Jan 24, 2018
1 parent 5ffdaf0 commit 2eb64d8
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions packages/gatsby-remark-images/src/index.js
Expand Up @@ -141,14 +141,16 @@ module.exports = (
fileType !== `svg`
) {
const rawHTML = await generateImagesAndUpdateNode(node, resolve)
// Replace the image node with an inline HTML node.
node.type = `html`
node.value = rawHTML
return resolve(node)
} else {
// Image isn't relative so there's nothing for us to do.
return resolve()

if (rawHTML != null) {
// Replace the image node with an inline HTML node.
node.type = `html`
node.value = rawHTML
}
}

// Image isn't relative so there's nothing for us to do.
return resolve()
})
)
).then(markdownImageNodes =>
Expand Down Expand Up @@ -197,11 +199,14 @@ module.exports = (
formattedImgTag,
resolve
)
// Replace the image string
thisImg.replaceWith(rawHTML)
} else {
return resolve()

if (rawHTML != null) {
// Replace the image string
thisImg.replaceWith(rawHTML)
}
}

return resolve()
}

// Replace the image node with an inline HTML node.
Expand Down

0 comments on commit 2eb64d8

Please sign in to comment.