remark-strip-badges
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
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:
var fs = require('fs')
var remark = require('remark')
var strip = require('remark-strip-badges')
remark()
.use(strip)
.process(fs.readFileSync('example.md'), function(err, file) {
if (err) throw err
console.log(String(file))
})
Now, running node example
yields:
# remark-strip-badges
[badge]: https://img.shields.io/travis/remarkjs/remark-strip-badges.svg
API
remark.use(stripBadges)
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.
Related
remark-squeeze-paragraphs
— Remove empty paragraphs (potentially left behind by this plugin)
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.