unified

Project: remarkjs/remark-unlink

Package: remark-unlink@3.0.0

  1. Dependencies: 0·Dependents: 0
  2. remark plugin to remove all links, images, references, and definitions
  1. remark 187
  2. unified 164
  3. markdown 130
  4. plugin 127
  5. mdast 87
  6. remark-plugin 69
  7. text 17
  8. remove 10
  9. filter 5
  10. links 4

remark-unlink

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to remove all links, images, references, and definitions.

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.

Note!

This plugin is ready for the new parser in remark (remarkjs/remark#536). No change is needed: it works exactly the same now as it did before!

Install

npm:

npm install remark-unlink

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 unlink = require('remark-unlink')

remark()
  .use(unlink)
  .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

More content.

API

Plugin to remove all links, images, references, and definitions.

Security

Use of remark-unlink 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 © Eugene Sharygin