Skip to content

Repository files navigation

markdown-it-external-link

NPM versionDownloadsAppVeyor 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

constmarkdownit=require('markdown-it');constmarkdownitExternalLink=require('../index').default;constmd=markdownit();consttestString='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.

About

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

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages