1.0.0 • Published 3 years ago

markdown-it-external-anchor v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

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, 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

License

MIT © Binyamin Green