https://github.com/binyamin/markdown-it-external-anchor
Mark external, absolute links with necessary attributes
https://github.com/binyamin/markdown-it-external-anchor
markdown-it markdown-it-plugin xss
Last synced: 9 months ago
JSON representation
Mark external, absolute links with necessary attributes
- Host: GitHub
- URL: https://github.com/binyamin/markdown-it-external-anchor
- Owner: binyamin
- License: mit
- Created: 2020-11-24T18:36:41.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-27T16:09:46.000Z (about 1 year ago)
- Last Synced: 2024-10-27T18:57:09.845Z (about 1 year ago)
- Topics: markdown-it, markdown-it-plugin, xss
- Language: JavaScript
- Homepage:
- Size: 145 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# MarkdownIt External Anchor
[](https://npmjs.com/package/markdown-it-external-anchor)
[](https://github.com/binyamin/markdown-it-external-anchor/actions)
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](https://binyam.in/contact).
## Install
```console
$ npm install --save markdown-it markdown-it-external-anchor
```
## Usage
```js
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](https://github.com/binyamin/markdown-it-external-anchor/blob/main/CONTRIBUTING.md) 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](https://github.com/binyamin/markdown-it-external-anchor/blob/main/LICENSE) © [Binyamin Green](https://binyam.in)