Skip to content

Commit

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

Fixes #3608

* Revert invalid indentation changes
  • Loading branch information
kripod authored and KyleAMathews committed Jan 19, 2018
1 parent d19ec31 commit 01022ab
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions packages/gatsby-remark-images/src/index.js
Original file line number Diff line number Diff line change
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 01022ab

Please sign in to comment.