Skip to content

Commit 4b93d86

Browse files
committed
Fixed internal href should not link out
1 parent d3a23ad commit 4b93d86

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

public/js/extra.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function postProcess(code) {
209209
return "<noiframe>" + $(this).html() + "</noiframe>"
210210
});
211211
//link should open in new window or tab
212-
result.find('a:not([target])').attr('target', '_blank');
212+
result.find('a:not([href^=#]):not([target])').attr('target', '_blank');
213213
//update continue line numbers
214214
var linenumberdivs = result.find('.gutter.linenumber').toArray();
215215
for (var i = 0; i < linenumberdivs.length; i++) {
@@ -374,7 +374,7 @@ function smoothHashScroll() {
374374
if (hash) {
375375
$element.on('click', function (e) {
376376
// store hash
377-
var hash = this.hash;
377+
var hash = decodeURIComponent(this.hash);
378378
if ($(hash).length <= 0) return;
379379
// prevent default anchor click behavior
380380
e.preventDefault();

0 commit comments

Comments
 (0)