gatsby-remark-remove-comments

Downloads Size

This is a plugin for gatsby-transformer-remark that removes HTML comments from the processed output.

It’s just the Gatsby version of remark-remove-comments.

Install

npm:

npm install gatsby-remark-remove-comments

In gatsby-config.js, add:

  module.exports = {
    plugins: [
      {
        resolve: 'gatsby-transformer-remark',
        options: {
+         plugins: [
+           'gatsby-remark-remove-comments',
+         ],
        },
      },
    ],
  };

Use

By default, in Remark, HTML comments in Markdown will appear in the output, this plugin removes them.

For the following Markdown file:

# Hello World

This is a markdown file, with text in it.

<!-- But in this file there's a comment, like "TODO: fix 😅",
  I don't want this to appear in the HTML output, it's just for me -->

Before adding the plugin

<h1>Hello World</h1>
<p>This is a markdown file, with text in it.</p>
<!-- But in this file there's a comment, like "TODO: fix 😅",
  I don't want this to appear in the HTML output, it's just for me -->

After adding the plugin

<h1>Hello World</h1>
<p>This is a markdown file, with text in it.</p>

License

MIT © https://alvin.codes/