unified

Project: remarkjs/remark-unlink

Package: remark-unlink@3.0.0

  1. Dependencies: 2·Dependents: 0
  2. remark plugin to remove all links, images, references, and definitions
  1. remark 185
  2. unified 145
  3. plugin 128
  4. markdown 109
  5. remark-plugin 71
  6. mdast 71
  7. text 17
  8. remove 10
  9. filter 4
  10. links 2

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.

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