Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

maraisr/posthtml-obfuscate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PostHTML Obfuscate

NPM version Travis Codecov

Obfuscates emails to make it harder for bots to recognize.

Install

yarn add 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)

About

PostHTML plugin that obfuscates emails.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors