JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 707
  • Score
    100M100P100Q104243F
  • License MIT

remark plugin to change links and images to references with separate definitions

Package Exports

  • remark-defsplit

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-defsplit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

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:

import {readSync} from 'to-vfile'
import {remark} from 'remark'
import remarkDefsplit from 'remark-defsplit'

const file = readSync('example.md')

remark()
  .use(remarkDefsplit, {id: ['travis-badge', 'travis']})
  .process(file)
  .then((file) => {
    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

This package exports no identifiers. The default export is remarkDefsplit.

unified().use(remarkDefsplit[, options])

Change links and images to references with separate definitions.

options.id

Identifiers to use for new definitions instead of autogenerated ones (string or 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.

  • remark-reference-links — Practically the same as remark-defsplit, but with numeric identifiers instead of URI-based ones
  • remark-inline-links — Reverse, thus rewriting references and definitions into links and images

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