fix(githubMentions): githubMentions now works with openLinksInNewWindow options

githubMentions links can now be opened in new windows when using the option openLinksInNewWindow

Closes #403
This commit is contained in:
Tobi 2017-06-22 04:16:53 +02:00 committed by Estevão Soares dos Santos
parent a2259c063b
commit 1194d8803e
3 changed files with 8 additions and 4 deletions

View File

@ -10,7 +10,7 @@ Important HOTFIX
<a name="1.7.0"></a> <a name="1.7.0"></a>
# [1.7.0](https://github.com/showdownjs/showdown/compare/1.6.4...1.7.0) (2017-06-01) ## [1.7.0](https://github.com/showdownjs/showdown/compare/1.6.4...1.7.0) (2017-06-01)
(DEPRECATED) (DEPRECATED)

View File

@ -55,7 +55,7 @@
"quiet-grunt": "^0.2.3", "quiet-grunt": "^0.2.3",
"semver": "^5.0.0", "semver": "^5.0.0",
"semver-sort": "0.0.4", "semver-sort": "0.0.4",
"sinon": "^1.14.1", "sinon": "^2.3.3",
"source-map-support": "^0.4.15" "source-map-support": "^0.4.15"
}, },
"dependencies": { "dependencies": {

View File

@ -82,8 +82,12 @@ showdown.subParser('anchors', function (text, options, globals) {
if (!showdown.helper.isString(options.ghMentionsLink)) { if (!showdown.helper.isString(options.ghMentionsLink)) {
throw new Error('ghMentionsLink option must be a string'); throw new Error('ghMentionsLink option must be a string');
} }
var lnk = options.ghMentionsLink.replace(/\{u}/g, username); var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
return st + '<a href="' + lnk + '">' + mentions + '</a>'; target = '';
if (options.openLinksInNewWindow) {
target = ' target="¨E95Eblank"';
}
return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
}); });
} }