Skip to content

Commit

Permalink
fix(openLinksInNewWindow): hash links are not affected by the option
Browse files Browse the repository at this point in the history
Closes #457
  • Loading branch information
tivie committed Nov 11, 2017
1 parent c956ede commit 11936ec
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/subParsers/anchors.js
Expand Up @@ -44,7 +44,9 @@ showdown.subParser('anchors', function (text, options, globals) {
result += ' title="' + title + '"';
}

if (options.openLinksInNewWindow) {
// optionLinksInNewWindow only applies
// to external links. Hash links (#) open in same page
if (options.openLinksInNewWindow && !/^#/.test(url)) {
// escaped _
result += ' target="¨E95Eblank"';
}
Expand Down
@@ -0,0 +1 @@
<p>this link is in the <a href="#same-page">same page</a></p>
@@ -0,0 +1 @@
this link is in the [same page](#same-page)

0 comments on commit 11936ec

Please sign in to comment.