remark-remove-links
v3.0.0
Published
remark plugin to remove all links, references, and definitions
Downloads
6
Maintainers
Readme
remark-remove-links
remark plugin to remove all links, references, and definitions. Similar to remark-unlink but allows images.
Original motivation was to process Markdown documents in a way that would make it easier to read as a plain text. On an ebook reader or a piece of paper the links are useless and look ugly.
Install
npm:
npm install remark-remove-links
Use
Say we have the following file, example.md
.
Imagine section titles and URLs a bit longer though.
## TOC
- [section 1](#section-1)
- [section 2](#section-2)
## section 1
Section [content][1] may include some [links](https://domain.name/path).
[1]: https://domain.name/path
## section 2
![some images are here also](https://gif.com/1.gif)
More content.
And our script, example.js
, looks as follows:
var vfile = require('to-vfile')
var remark = require('remark')
var removeLinks = require('remark-remove-links')
remark()
.use(removeLinks)
.process(vfile.readSync('example.md'), function(err, file) {
if (err) throw err
console.log(String(file))
})
Now, running node example
yields:
## TOC
- section 1
- section 2
## section 1
Section content may include some links.
## section 2
![some images are here also](https://gif.com/1.gif)
More content.
API
remark().use(removeLinks)
Plugin to remove all links, references, and definitions.
Security
Use of remark-remove-links
does not involve rehype
(hast)or user content so there are no openings for
cross-site scripting (XSS) attacks.
Contribute
See contributing.md
in mcchrish/.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, organisation, or community you agree to abide by its terms.
License
MIT © Michael Chris Lopez