Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

gatsby-remark-find-replace

angeloashmore145.1kMIT0.3.0

Gatsby remark plugin to find and replace text

gatsby, gatsby-plugin, gatsby-transformer-remark, remark, markdown

readme

gatsby-remark-find-replace

Gatsby remark plugin to find and replace text.

Install

npm install --save gatsby-remark-find-replace

How to use

// In your gatsby-config.js
plugins: [
  'gatsby-plugin-sharp',
  {
    resolve: 'gatsby-transformer-remark',
    options: {
      plugins: [
        {
          resolve: 'gatsby-remark-find-replace',
          options: {
            // List your find and replace values. Both values must be strings.
            // This is required.
            replacements: {
              COMPANY: 'My Company',
              COPYRIGHT: `Copyright ${new Date().getFullYear()} My Company`,
            },

            // By default, find values are prefixed to reduce the chances of
            // conflicting with real content. You can change the prefix here.
            // Set to `false` to disable the prefix.
            prefix: '%',
          },
        },
      ],
    },
  },
]

Example

# My Special Blog Post

Welcome to %COMPANY's new blog! Please do not copy this post.

%COPYRIGHT

Turns into…

# My Special Blog Post

Welcome to My Company's new blog! Please do not copy this post.

Copyright 2019 My Company

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

0.3.0 (2020-01-12)

Features

  • replace text in code blocks, inline code, & links (3759c6f)

Bug Fixes

0.2.0 (2019-04-05)

Features

  • change default prefix to % (fe6d70b)

0.1.0 (2019-04-05)

Features