Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
feat: wrap inline images in .inline-gallery too
Browse files Browse the repository at this point in the history
  • Loading branch information
CanRau committed Dec 14, 2019
1 parent 5040896 commit 4f9ed65
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions packages/gatsby-remark-wrap-images/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,27 @@ function modifier(node, index, parent) {
)

const onlyContainsImages = whitespaceStripped.every(
x => x.type === `html` && x.value.includes(`gatsby-resp-image-figure`)
x =>
x.type === `html` && /(gatsby-resp-image-)[figure|wrapper]/.test(x.value)
)

/**
* Debugging help
*/
// // parent.children.find(
// // x => x && x.value && x.value.includes(`IMG_9004`)
// // ) &&
// require(`fs`).writeFile(
// `./InlineGallery.log`,
// `\n\n
// Debugging help
// const debugContent = `\n\n
// [[parent.children]]:\n
// ${JSON.stringify(parent.children, null, 2)}
// \n
// [[whitespaceStripped]]:\n
// ${JSON.stringify(whitespaceStripped, null, 2)}
// [[onlyContainsImages]]:${JSON.stringify(onlyContainsImages, null, 2)}
// \n\n`,
// { flag: `a` },
// err => err && console.log(err)
// )
// \n\n`
// // parent.children.find(x => x && x.value && x.value.includes(`EvaDieBand`)) &&
// require(`fs`).writeFile(
// `./InlineGallery.log`,
// debugContent,
// { flag: `a` },
// err => err && console.log(err)
// )
// End Debugger

if (onlyContainsImages) {
parent.type = `div`
Expand Down

0 comments on commit 4f9ed65

Please sign in to comment.