Skip to content

abv/gatsby-remark-static-images

 
 

Repository files navigation

gatsby-remark-static-images

Copy images in markdown without processing them. Can be used in combination with gatsby-remark-images to copy SVG and GIF files. Make sure to place this plugin after gatsby-remark-images.

Getting started

yarn add --dev gatsby-remark-static-images

Usage

// gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-transformer-remark',
    options: {
      plugins: [
        'gatsby-remark-static-images'
      ]
    }
  }
]

Customization

By default files are saved to public/static and named ${fileNode.name}-${fileNode.internal.contentDigest}.${fileNode.extension}. This can be overridden like so:

// gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-transformer-remark',
    options: {
      plugins: [
        'gatsby-remark-static-images',
        generateImageName: (fileNode) => {
          return `${fileNode.internal.contentDigest}/${fileNode.name}.${fileNode.extension}`
        }
      ]
    }
  }
]

About

Copy images in markdown without processing them

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%