Remark plugin to remove HTML comments from the processed output
npm install @xunnamius/remark-remove-comments
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]


Remark plugin to remove HTML comments from the processed output.
This package is ESM only.
In Node.js (version 14.14+, or 16.0+, 18.0+, 19.0+), install with npm:
``sh`
npm install remark-remove-comments
Say we have the following file, example.md:
`markdownHello World
This is a markdown file, with text in it.
`
And our script, example.js, looks as follows:
`js
import { readFileSync } from 'node:fs';
import remark from 'remark';
import removeComments from 'remark-remove-comments';
remark()
.use(removeComments)
.process(readFileSync('example.md', 'utf-8'), (err, file) => {
if (err) throw err;
console.log(String(file));
});
`
Now, running node example yields:
`markdownHello World
This is a markdown file, with text in it.
``
Removes every HTML node that matches this regex
MIT © https://alvin.codes/
[downloads-badge]: https://img.shields.io/npm/dm/remark-remove-comments.svg?style=flat-square
[downloads]: https://www.npmjs.com/package/remark-remove-comments
[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-remove-comments.svg?style=flat-square
[size]: https://bundlephobia.com/result?p=remark-remove-comments