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 at all, just open an issue or contact me.
$ npm install --save markdown-it markdown-it-external-anchor
const md = require("markdown-it")();
md.use(require("markdown-it-external-anchor"), {
domain: "example.net",
class: "external"
});
md.render("[text](https://example.com)");
- domain (default:
null
) - A domain which is considered an internal link.- When domain is provided, localhost is implicit.
- class (default:
null
) - a class name, for CSS purposes
You can help by reporting bugs, suggesting features, or just giving general feedback! See the contributing guidelines for more information.
This is just a personal project, so I don't expect contributions. That said, I'm open to all suggestions.