unified

Project: remarkjs/remark-reference-links

Package: remark-reference-links@5.0.0

  1. Dependencies: 1·Dependents: 12
  2. remark plugin to transform links and images to references and definitions
  1. remark 182
  2. unified 146
  3. plugin 130
  4. markdown 104
  5. remark-plugin 72
  6. mdast 72
  7. link 13
  8. definition 13
  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.

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