1.1.9 • Published 3 months ago
marked-mangle v1.1.9
marked-mangle
Mangle mailto links with HTML character references.
Mangling mailto links in this way is useful when you want to prevent email harvesting bots from collecting email addresses from your website, in the case that the Markdown is server-rendered. It's also useful for preventing the browser from automatically opening the user's default email client when clicking on a mailto link.
Usage
import { marked } from "marked";
import { mangle } from "marked-mangle";
// or UMD script
// <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
// <script src="https://cdn.jsdelivr.net/npm/marked-mangle/lib/index.umd.js"></script>
marked.use(mangle());
marked.parse("email@example.com");
// <p><a href="mailto:email@example.com">email@example.com</a></p>