unified

Project: remarkjs/remark-reference-links

Package: remark-reference-links@5.0.0

  1. Dependencies: 0·Dependents: 11
  2. remark plugin to transform links and images to references and definitions
  1. remark 195
  2. unified 167
  3. markdown 135
  4. plugin 130
  5. mdast 88
  6. remark-plugin 74
  7. link 16
  8. definition 14
  9. image 12
  10. reference 9

remark-reference-links

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to transform links and images into references and definitions.

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-reference-links

Use

Say we have the following file, example.md:

[foo](http://example.com "Example Domain"), [foo](http://example.com "Example Domain"), [bar](http://example.com "Example Domain").

![foo](http://example.com "Example Domain"), ![foo](http://example.com "Example Domain"), ![bar](http://example.com "Example Domain").

And our script, example.js, looks as follows:

var fs = require('fs')
var remark = require('remark')
var links = require('remark-reference-links')

remark()
  .use(links)
  .process(fs.readFileSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

[foo][1], [foo][1], [bar][1].

![foo][1], ![foo][1], ![bar][1].

[1]: http://example.com "Example Domain"

API

Plugin to transform links and images into references and definitions.

Security

Use of remark-reference-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 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 © Titus Wormer