-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(encodeEmail): add option to enable/disable mail obfuscation
Prior to version 1.6.1, emails would always be obfuscated through dec and hex encoding. This option makes it possible to disable this.
- Loading branch information
Showing
13 changed files
with
150 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>this email <a href="mailto:[email protected]">[email protected]</a> should not be encoded</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this email <[email protected]> should not be encoded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Created by Estevao on 27/01/2017. | ||
*/ | ||
|
||
var bootstrap = require('../bootstrap.js'), | ||
showdown = bootstrap.showdown, | ||
encoder = showdown.helper.encodeEmailAddress; | ||
|
||
describe('encodeEmailAddress', function () { | ||
'use strict'; | ||
var email = '[email protected]', | ||
encodedEmail = encoder(email); | ||
|
||
it('should encode email', function () { | ||
encodedEmail.should.not.equal(email); | ||
}); | ||
|
||
it('should decode to original email', function () { | ||
var decodedEmail = encodedEmail.replace(/&#(.+?);/g, function (wm, cc) { | ||
if (cc.charAt(0) === 'x') { | ||
//hex | ||
return String.fromCharCode('0' + cc); | ||
} else { | ||
//dec | ||
return String.fromCharCode(cc); | ||
} | ||
}); | ||
decodedEmail.should.equal(email); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters