markdown-it-external-anchor
v1.0.0
Published
Mark external, absolute links with necessary attributes
Downloads
87
Maintainers
Readme
MarkdownIt External Anchor
Mark external, absolute links with appropriate rel & target attributes
- Prevents XSS attacks & provides good UX
- Does not affect HTML within markdown
Note: If you want anything, just open an issue or contact me.
Install
$ npm install --save markdown-it markdown-it-external-anchor
Usage
const md = require("markdown-it")();
md.use(require("markdown-it-external-anchor"), {
domain: "example.net",
class: "external"
});
md.render("[text](https://example.com)");
Options
- domain (default:
null
) - A domain which is considered an internal link. (no "https://"). When provided, localhost is also added. - class (default:
null
) - a class name, for CSS purposes