unified

Project: remarkjs/remark-strip-badges

Package: remark-strip-badges@6.0.0

  1. Dependents: 6
  2. remark plugin to remove badges (such as shields.io)
  1. remark 190
  2. unified 174
  3. plugin 137
  4. markdown 131
  5. mdast 85
  6. remark-plugin 73
  7. remove 10
  8. clean 6
  9. strip 2

remark-strip-badges

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to strip badges (such as shields.io).

Note!

This plugin is ready for the new parser in remark (remarkjs/remark#536). The current and previous versions of the plugin work with the current and previous versions of remark.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install remark-strip-badges

Use

Say we have the following file, example.md:

# remark-strip-badges ![Build Status][badge]

[badge]: https://img.shields.io/travis/remarkjs/remark-strip-badges.svg

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

import fs from 'node:fs'
import {remark} from 'remark'
import remarkStripBadges from 'remark-strip-badges'

const buf = fs.readFileSync('example.md')

remark()
  .use(remarkStripBadges)
  .process(buf)
  .then((file) => {
    console.log(String(file))
  })

Now, running node example yields:

# remark-strip-badges

[badge]: https://img.shields.io/travis/remarkjs/remark-strip-badges.svg

API

This package exports no identifiers. The default export is remarkStripBadges.

unified().use(remarkStripBadges)

Plugin to strip badges (such as shields.io).

Security

Use of remark-strip-badges does not involve rehype (hast) or user content so there are no openings for cross-site scripting (XSS) attacks.

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer