fix(encodeEmail): now produces valid emails

Closes #340
This commit is contained in:
Estevao Soares dos Santos 2017-02-06 06:50:52 +00:00
parent 368f0b6309
commit 605d8b7b05
8 changed files with 13 additions and 5 deletions

6
dist/showdown.js vendored
View File

@ -170,6 +170,10 @@ var showdown = {},
ghCompatibleHeaderId: true, ghCompatibleHeaderId: true,
ghMentions: true ghMentions: true
}, },
original: {
noHeaderId: true,
ghCodeBlocks: false
},
vanilla: getDefaultOpts(true), vanilla: getDefaultOpts(true),
allOn: allOptionsOn() allOn: allOptionsOn()
}; };
@ -1404,8 +1408,8 @@ showdown.subParser('autoLinks', function (text, options, globals) {
b = b || ''; b = b || '';
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals); mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
if (options.encodeEmails) { if (options.encodeEmails) {
mail = showdown.helper.encodeEmailAddress(mail);
href = showdown.helper.encodeEmailAddress(href + mail); href = showdown.helper.encodeEmailAddress(href + mail);
mail = showdown.helper.encodeEmailAddress(mail);
} else { } else {
href = href + mail; href = href + mail;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,10 @@ var showdown = {},
ghCompatibleHeaderId: true, ghCompatibleHeaderId: true,
ghMentions: true ghMentions: true
}, },
original: {
noHeaderId: true,
ghCodeBlocks: false
},
vanilla: getDefaultOpts(true), vanilla: getDefaultOpts(true),
allOn: allOptionsOn() allOn: allOptionsOn()
}; };

View File

@ -40,8 +40,8 @@ showdown.subParser('autoLinks', function (text, options, globals) {
b = b || ''; b = b || '';
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals); mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
if (options.encodeEmails) { if (options.encodeEmails) {
mail = showdown.helper.encodeEmailAddress(mail);
href = showdown.helper.encodeEmailAddress(href + mail); href = showdown.helper.encodeEmailAddress(href + mail);
mail = showdown.helper.encodeEmailAddress(mail);
} else { } else {
href = href + mail; href = href + mail;
} }

View File

View File