1.0.1 • Published 11 months ago
rehype-target-plugin v1.0.1
rehype-target-plugin
Zero-config rehype plugin to add target="_blank"
to your external links. Only one dependency.
Install
npm install rehype-target-plugin
How to use
import { rehype } from "rehype";
import rehypeTargetBlank from 'rehype-target-plugin'
rehype()
.use(rehypeTargetBlank)
.process('<a href="https://external.com">external link</a>')
Output
<a href="https://external.com" target="_blank">external link</a>
See the example.js
node example.js