unified

Project: remarkjs/remark-inline-links

Package: remark-inline-links@4.0.0

  1. Dependencies: 2·Dependents: 8
  2. remark plugin to transform references and definitions into normal links and images
  1. remark 182
  2. unified 146
  3. plugin 130
  4. markdown 104
  5. remark-plugin 72
  6. mdast 72
  7. definition 13
  8. link 13
  9. image 12
  10. reference 9

remark-inline-links

Build Coverage Downloads Size Sponsors Backers Chat

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

Install

npm:

npm install remark-inline-links

Use

Say we have the following file, example.md:

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

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

[foo]: 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-inline-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](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").

API

Plugin to transform references and definitions into normal links and images.

options
options.commonmark

Handle definitions as CommonMark (boolean, default: false). The default behavior is to prefer the last found duplicate definition. Turn on to use CommonMark handling of duplicate definitions: use the first definition, ignore duplicate definitions.

Security

Use of remark-inline-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