Skip to content

binyamin/markdown-it-external-anchor

Repository files navigation

MarkdownIt External Anchor

npm bundle size CI Test

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.

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.
    • When domain is provided, localhost is implicit.
  • class (default: null) - a class name, for CSS purposes

Contributing

You can help by reporting bugs, suggesting features, or just giving general feedback! See the contributing guidelines for more information.

Maintenance

This is just a personal project, so I don't expect contributions. That said, I'm open to all suggestions.

License

MIT © Binyamin Green

About

Mark external, absolute links with necessary attributes

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published