markdown-it plugin that adds target and rel attributes on external links.
Via npm
npm install markdown-it-external-linkVia Yarn
yarn add markdown-it-external-linkconstmarkdownit=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));| Attributes | Type | Required | Default | Description |
|---|---|---|---|---|
| hosts | Array | Yes | [] | Site hostname(s) to detect external links. |
| target | String | No | _blank | Specifies where to open the linked document. |
| rel | String | No | noopener | Specifies the relationship between the current document and the linked document. |