From 1194d8803ed1a96a6b38af30831529dcc6a85cbd Mon Sep 17 00:00:00 2001 From: Tobi Date: Thu, 22 Jun 2017 04:16:53 +0200 Subject: [PATCH] fix(githubMentions): githubMentions now works with openLinksInNewWindow options githubMentions links can now be opened in new windows when using the option openLinksInNewWindow Closes #403 --- CHANGELOG.md | 2 +- package.json | 2 +- src/subParsers/anchors.js | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1971756..14a2923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Important HOTFIX -# [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) diff --git a/package.json b/package.json index 5563685..24a9b31 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "quiet-grunt": "^0.2.3", "semver": "^5.0.0", "semver-sort": "0.0.4", - "sinon": "^1.14.1", + "sinon": "^2.3.3", "source-map-support": "^0.4.15" }, "dependencies": { diff --git a/src/subParsers/anchors.js b/src/subParsers/anchors.js index 5779368..49676ea 100644 --- a/src/subParsers/anchors.js +++ b/src/subParsers/anchors.js @@ -82,8 +82,12 @@ showdown.subParser('anchors', function (text, options, globals) { if (!showdown.helper.isString(options.ghMentionsLink)) { throw new Error('ghMentionsLink option must be a string'); } - var lnk = options.ghMentionsLink.replace(/\{u}/g, username); - return st + '' + mentions + ''; + var lnk = options.ghMentionsLink.replace(/\{u}/g, username), + target = ''; + if (options.openLinksInNewWindow) { + target = ' target="¨E95Eblank"'; + } + return st + '' + mentions + ''; }); }