posthtml-obfuscate

PostHTML plugin that'll obfuscate emails etc...


Keywords
posthtml, obfuscate, mailto, email
License
MIT
Install
npm install posthtml-obfuscate@0.1.2

Documentation

PostHTML Obfuscate

NPM version Travis Codecov

Obfuscates emails to make it harder for bots to recognize.

Install

npm i posthtml-obfuscate -D

Output

<!-- Before -->
<a href="mailto:sam@smith.com">
    sam@smith.com
</a>

<!-- After -->
<a href="mailto:&#115;&#97;&#109;&#64;&#115;&#109;&#105;&#116;&#104;&#46;&#99;&#111;&#109;">
    &#115;&#97;&#109;&#64;&#115;&#109;&#105;&#116;&#104;&#46;&#99;&#111;&#109;
</a>

Usage

const posthtml = require('posthtml');
const phObfuscate= require('posthtml-obfuscate');

const options = {
    includeMailto: false
};

posthtml([phObfuscate(options)])
    .process(myHtml)
    .then(result => {
        console.log(result.html); // The output
    });

Options

  • includeMailto: Boolean - Includes the mailto: prefix in the obfuscation. (Default: false)