JSPM

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

Automatically add target et rel attributes on external links

Package Exports

  • remark-external-links

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-external-links) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

remark-external-links Build Status NPM version

Automatically add target et rel attributes on external links.

Install

npm:

npm install remark-external-links --save

yarn:

yarn add remark-external-links

Example

remark-external-links is designed to work with remark-html. It add target and rel attributes on external links:

var externalLinks = require("remark-external-links")
var html = require("remark-html")
var remark = require("remark")

// OR

import externalLinks from "remark-external-links"
import html from "remark-html"
import remark from "remark"

remark()
  .use(externalLinks)
  .use(html)
  .process("[remark](https://github.com/gnab/remark)")

// yield
// <p><a href="https://github.com/gnab/remark" target="_blank" rel="nofollow noopener noreferrer">remark</a></p>

Note that this module must be included before remark-html.

API

options

target

Type: string Default: _blank

Specifies where to display the linked URL. The value should be on of : _self, _blank, _parent, _top

rel

Type: string Default: nofollow noopener noreferrer

Specifies the relationship of the target object to the link object. The value is a space-separated list of link types.

When using target, consider adding rel="noopener noreferrer" to avoid exploitation of the window.opener API.

Changelog

See changelog

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

Development

Clean lib folder

npm run clean

Build lib folder

npm run build

Lint src folder

npm run lint

Test src folder

npm run test

License

MIT