Project: remarkjs/remark-unlink

Package: remark-unlink@3.1.0

  1. Dependencies: 0·Dependents: 0
  2. remark plugin to remove all links, images, references, and definitions
  1. remark 195
  2. unified 167
  3. markdown 135
  4. plugin 130
  5. mdast 88
  6. remark-plugin 74
  7. text 18
  8. remove 10
  9. filter 5
  10. links 5


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.


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!



npm install remark-unlink


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')

  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err

Now, running node example yields:

## TOC

-   section 1
-   section 2

## section 1

Section content may include some links.

## section 2

More content.


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


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


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.


MIT © Eugene Sharygin