@@ -29,6 +29,9 @@ function applyBasicMdxFixes(content) {
29
29
30
30
return `:::${ docusaurusType } \n${ cleanContent } \n:::\n` ;
31
31
} )
32
+ // Fix HTML comments for MDX compatibility
33
+ . replace ( / < ! - - \s * / g, '{/* ' )
34
+ . replace ( / \s * - - > / g, ' */}' )
32
35
// Fix HTML tags for MDX compatibility
33
36
. replace ( / < b r > / g, '<br />' )
34
37
. replace ( / < b r ( [ ^ / > ] * ?) > / g, '<br$1 />' )
@@ -60,6 +63,28 @@ function resolvePath(path, sourceDir, repoUrl, branch) {
60
63
return `${ repoUrl } /blob/${ branch } /${ rootPath } ` ;
61
64
}
62
65
66
+ // Handle complex relative paths with ../ navigation
67
+ if ( cleanPath . includes ( '../' ) ) {
68
+ // Split the source directory and the relative path
69
+ const sourceParts = sourceDir ? sourceDir . split ( '/' ) : [ ] ;
70
+ const pathParts = cleanPath . split ( '/' ) ;
71
+
72
+ // Process each part of the path
73
+ const resolvedParts = [ ...sourceParts ] ;
74
+ for ( const part of pathParts ) {
75
+ if ( part === '..' ) {
76
+ // Go up one directory
77
+ resolvedParts . pop ( ) ;
78
+ } else if ( part !== '.' && part !== '' ) {
79
+ // Add the directory/file part
80
+ resolvedParts . push ( part ) ;
81
+ }
82
+ }
83
+
84
+ const resolvedPath = resolvedParts . join ( '/' ) ;
85
+ return `${ repoUrl } /blob/${ branch } /${ resolvedPath } ` ;
86
+ }
87
+
63
88
// Handle regular relative paths - these are relative to the source file's directory
64
89
const fullPath = sourceDir ? `${ sourceDir } /${ cleanPath } ` : cleanPath ;
65
90
return `${ repoUrl } /blob/${ branch } /${ fullPath } ` ;
0 commit comments