Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

remark-inline-links

3.1.3 • Public • Published

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

remark().use(inlineLinks[, options])

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

options
options.commonmark

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

Related

  • remark-bookmarks — Link manager
  • remark-reference-links — Reverse of remark-inline-links, thus rewriting normal links and images into references and definitions
  • remark-defsplit — Practically the same as remark-reference-links, but with URI-based identifiers instead of numerical ones
  • remark-unlink — Remove all links, references and definitions

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, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Install

npm i remark-inline-links

DownloadsWeekly Downloads

3,898

Version

3.1.3

License

MIT

Unpacked Size

8.24 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar