@@ -495,6 +495,35 @@ export class HTMLGenerator {
495
495
// use the headers inner text as the id
496
496
headerEl . setAttribute ( "id" , headerEl . textContent ?. replaceAll ( " " , "_" ) ?? "" ) ;
497
497
} ) ;
498
+
499
+ const backlinkNodes = file . document . querySelectorAll ( '.tree-item.search-result' ) ;
500
+ if ( backlinkNodes ?. length > 0 ) {
501
+ backlinkNodes . forEach ( node => {
502
+ const title = ( node . querySelector ( '.tree-item-inner' ) as HTMLElement ) . innerText ;
503
+ let targetFile = app . metadataCache . getFirstLinkpathDest ( title , file . markdownFile . path ) ;
504
+ if ( targetFile ) {
505
+ let targetPath = new Path ( targetFile . path ) ;
506
+ if ( htmlCompatibleExt . includes ( targetPath . extensionName ) ) targetPath . setExtension ( "html" ) ;
507
+ if ( InvioSettingTab . settings . makeNamesWebStyle ) targetPath . makeWebStyle ( ) ;
508
+ const finalPath = targetPath . makeUnixStyle ( ) . asString ;
509
+
510
+ // Setup matched link route
511
+ const matchedTextNodes = node . querySelectorAll ( '.search-result-file-match' ) ;
512
+ if ( matchedTextNodes ) {
513
+ matchedTextNodes . forEach ( element => {
514
+ const matchedANodes : HTMLElement = document . createElement ( 'a' ) ;
515
+ matchedANodes . classList . add ( 'search-result-file-match' ) ;
516
+ matchedANodes . setAttribute ( "target" , "_self" ) ;
517
+ matchedANodes . setAttribute ( 'href' , finalPath ) ;
518
+ matchedANodes . innerHTML = element . innerHTML ;
519
+ element . parentElement . replaceChild ( matchedANodes , element ) ;
520
+ } ) ;
521
+ }
522
+ }
523
+ } )
524
+ }
525
+
526
+
498
527
}
499
528
500
529
private static getPageOnlyMeta ( file : TFile ) {
0 commit comments