Socket
Socket
Sign inDemoInstall

markdown-it-external-link

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    markdown-it-external-link

markdown-it plugin that adds `target` and `rel` attributes on external links.


Version published
Maintainers
1
Created

Changelog

Source

1.1.0 - Sep 27, 2023

Bug

  • Include ESM support

Readme

Source

NPM version Downloads AppVeyor Build Status

markdown-it plugin that adds target and rel attributes on external links.

Install

Via npm

npm install markdown-it-external-link

Via Yarn

yarn add markdown-it-external-link

Usage

const markdownit = require('markdown-it');
const markdownitExternalLink = require('../index').default;
const md = markdownit();

const testString = 'This is an [Example](http://example.com) link, [Google](https://google.com) link, [Facebook](https://facebook.com) link, [Test Example](http://test.example.com/) link, [Test2 Example](http://test2.example.com/) link and [Relative](/docs/concept/) link.';

// Mark http://example.com and http://test.example.com as internal domain.
md.use(markdownitExternalLink, {
  'hosts': [
    'http://example.com',
    'http://test.example.com'
  ]
});

console.log(md.render(testString));

Parameters

AttributesTypeRequiredDefaultDescription
hostsArrayYes[]Site hostname(s) to detect external links.
targetStringNo_blankSpecifies where to open the linked document.
relStringNonoopenerSpecifies the relationship between the current document and the linked document.

Keywords

FAQs

Last updated on 27 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc