Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-remove-comments

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-remove-comments

Remark plugin to remove HTML comments from the processed output

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.9K
increased by0.14%
Maintainers
1
Weekly downloads
 
Created
Source

remark-remove-comments

Downloads Size version MIT License

Remark plugin to remove HTML comments from the processed output.

Install

This package is ESM only. In Node.js (version 14.14+, or 16.0+, 18.0+, 19.0+), install with npm:

npm install remark-remove-comments

Use

Say we have the following file, example.md:

# 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 -->

And our script, example.js, looks as follows:

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:

# Hello World

This is a markdown file, with text in it.

API

remark().use(removeComments)

Removes every HTML node that matches this regex

License

MIT © https://alvin.codes/

Keywords

FAQs

Package last updated on 13 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc