Skip to content

Commit 4010dfe

Browse files
author
Ozan Tellioglu
committed
Internal Links Decoding
1 parent 9e61c71 commit 4010dfe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,15 @@ export class TransclusionHandler {
420420
let href = a.getAttr('href');
421421
// --> If no Alt Text, Add href as Link Text
422422
if (a.innerText === '') a.innerText = decodeURI(href);
423-
// If the link is a file, add class (which has event listener in main)
423+
// --> If link is a translucion, change the href to file name
424424
if (href.match(new RegExp('.*#.*'))) href = href.match(new RegExp('.*(?=#)'))[0];
425+
// --> If link is a file, add class (which has event listener in main)
426+
// and decode href for obsidian
425427
let file = app.metadataCache.getFirstLinkpathDest(decodeURI(href), '');
426-
if (file) a.addClass('oz-obsidian-inner-link');
428+
if (file) {
429+
a.setAttr('href', decodeURI(href));
430+
a.addClass('oz-obsidian-inner-link');
431+
}
427432
});
428433
};
429434
}

0 commit comments

Comments
 (0)