unified

Project: remarkjs/remark-defsplit

Package: remark-defsplit@3.0.0

  1. Dependencies: 1·Dependents: 2
  2. remark plugin to change links and images to references with separate definitions
  1. remark 205
  2. unified 155
  3. markdown 133
  4. plugin 132
  5. mdast 81
  6. remark-plugin 72
  7. link 15
  8. definition 14
  9. image 12
  10. url 11
  11. reference 9
  12. extract 2

remark-defsplit

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to change links and images to references with separate 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-defsplit

Use

Say we have the following file, example.md.

[![Build Status](https://travis-ci.org/remarkjs/remark-defsplit.svg?branch=main)](https://travis-ci.org/remarkjs/remark-defsplit)

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

var vfile = require('to-vfile')
var remark = require('remark')
var defsplit = require('remark-defsplit')

remark()
  .use(defsplit, {id: ['travis-badge', 'travis']})
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

[![Build Status][travis-badge]][travis]

[travis-badge]: https://travis-ci.org/remarkjs/remark-defsplit.svg?branch=main

[travis]: https://travis-ci.org/remarkjs/remark-defsplit

API

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

Change links and images to references with separate definitions.

options.id

Identifiers to use for new definitions instead of autogenerated ones (string or Array.<String>, default: []).

Security

Use of remark-defsplit 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 © Eugene Sharygin