posthtml-obfuscate
Version:
PostHTML plugin that'll obfuscate emails etc...
45 lines (35 loc) • 1.23 kB
Markdown
# PostHTML Obfuscate
[](https://www.npmjs.com/package/posthtml-obfuscate)
[](https://travis-ci.org/maraisr/posthtml-obfuscate)
[](https://codecov.io/github/maraisr/posthtml-obfuscate)
Obfuscates emails to make it harder for bots to recognize.
### Install
```sh
npm i posthtml-obfuscate -D
```
### Output
```html
<!-- Before -->
<a href="mailto:sam@smith.com">
sam@smith.com
</a>
<!-- After -->
<a href="mailto:sam@smith.com">
sam@smith.com
</a>
```
### Usage
```js
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)