@@ -520,11 +520,6 @@ exports.publish = function(taffyData, opts, tutorials) {
520520 ) . concat ( files ) ,
521521 indexUrl ) ;
522522
523- // common nav generation, no need for templating here, we already have full html
524- if ( docdash . commonNav ) {
525- fs . writeFileSync ( path . join ( outdir , 'nav.inc.html' ) , view . nav , 'utf8' ) ;
526- }
527-
528523 // set up the lists that we'll use to generate pages
529524 var classes = taffy ( members . classes ) ;
530525 var modules = taffy ( members . modules ) ;
@@ -596,7 +591,7 @@ exports.publish = function(taffyData, opts, tutorials) {
596591function linkTo ( longname , linkText , cssClass , fragmentId ) {
597592 const classString = cssClass ? util . format ( ' class="%s"' , cssClass ) : '' ;
598593 let fileUrl ;
599- const fragmentString = fragmentId ? `#${ fragmentId } ` : '' ;
594+ let fragmentString = fragmentId ? `#${ fragmentId } ` : '' ;
600595 let stripped ;
601596 let text ;
602597
@@ -621,14 +616,24 @@ function linkTo(longname, linkText, cssClass, fragmentId) {
621616 fileUrl = helper . longnameToUrl [ longname ] || '' ;
622617 text = linkText || longname ;
623618
619+ // If the URL contains a fragment (hash), extract it
620+ if ( fileUrl && fileUrl . indexOf ( '#' ) > - 1 ) {
621+ const parts = fileUrl . split ( '#' ) ;
622+ fileUrl = parts [ 0 ] ;
623+ // Only use the URL's fragment if no explicit fragmentId was provided
624+ if ( ! fragmentId ) {
625+ fragmentString = '#' + parts [ 1 ] ;
626+ }
627+ }
628+
624629 // Convert source file links to GitHub URLs if configured
625630 if ( fileUrl && githubSourceBaseUrl && ( fileUrl . endsWith ( '.js.md' ) || longname . endsWith ( '.js' ) ) ) {
626631 fileUrl = convertSourceLinkToGitHub ( fileUrl , longname ) ;
627632 }
628633 // Remove .md extension from internal links for VitePress compatibility
629634 // Handle both cases: with and without fragment identifiers
630635 else if ( fileUrl ) {
631- fileUrl = fileUrl . replace ( / \. m d ( # | $ ) / , '$1 ' ) ;
636+ fileUrl = fileUrl . replace ( / \. m d $ / , '' ) ;
632637 }
633638 }
634639
0 commit comments