Fixed internal href should not link out

This commit is contained in:
Wu Cheng-Han 2015-12-06 11:25:05 -06:00
parent d3a23ad72f
commit 4b93d868b0
1 changed files with 2 additions and 2 deletions

View File

@ -209,7 +209,7 @@ function postProcess(code) {
return "<noiframe>" + $(this).html() + "</noiframe>"
});
//link should open in new window or tab
result.find('a:not([target])').attr('target', '_blank');
result.find('a:not([href^=#]):not([target])').attr('target', '_blank');
//update continue line numbers
var linenumberdivs = result.find('.gutter.linenumber').toArray();
for (var i = 0; i < linenumberdivs.length; i++) {
@ -374,7 +374,7 @@ function smoothHashScroll() {
if (hash) {
$element.on('click', function (e) {
// store hash
var hash = this.hash;
var hash = decodeURIComponent(this.hash);
if ($(hash).length <= 0) return;
// prevent default anchor click behavior
e.preventDefault();