@@ -39,23 +39,36 @@ function removeEmojiMetadata(content) {
3939 */
4040function convertRelativeLinks ( content , pluginName ) {
4141 const baseUrl = `https://github.com/influxdata/influxdb3_plugins/blob/master/influxdata/${ pluginName } /` ;
42+ const rootUrl = 'https://github.com/influxdata/influxdb3_plugins/blob/master/' ;
43+
44+ // Convert relative README links (../../README.md, ../README.md, etc.)
45+ content = content . replace (
46+ / \[ ( [ ^ \] ] + ) \] \( ( \. \. \/ ) + R E A D M E \. m d \) / g,
47+ `[$1](${ rootUrl } README.md)`
48+ ) ;
4249
4350 // Convert TOML file links
4451 content = content . replace (
45- / \[ ( [ ^ \] ] + \. t o m l ) \] \( ( [ ^ ) ] + \. t o m l ) \) / g,
46- ( match , linkText , linkPath ) => `[${ linkText } ](${ baseUrl } ${ linkPath } )`
52+ / \[ ( [ ^ \] ] + \. t o m l ) \] \( \. ? \/ ? ( [ ^ ) ] + \. t o m l ) \) / g,
53+ ( match , linkText , linkPath ) => {
54+ const cleanPath = linkPath . replace ( / ^ \. \/ / , '' ) ;
55+ return `[${ linkText } ](${ baseUrl } ${ cleanPath } )` ;
56+ }
4757 ) ;
4858
4959 // Convert Python file links
5060 content = content . replace (
51- / \[ ( [ ^ \] ] + \. p y ) \] \( ( [ ^ ) ] + \. p y ) \) / g,
52- ( match , linkText , linkPath ) => `[${ linkText } ](${ baseUrl } ${ linkPath } )`
61+ / \[ ( [ ^ \] ] + \. p y ) \] \( \. ? \/ ? ( [ ^ ) ] + \. p y ) \) / g,
62+ ( match , linkText , linkPath ) => {
63+ const cleanPath = linkPath . replace ( / ^ \. \/ / , '' ) ;
64+ return `[${ linkText } ](${ baseUrl } ${ cleanPath } )` ;
65+ }
5366 ) ;
5467
5568 // Convert main README reference
5669 content = content . replace (
5770 '[influxdb3_plugins/README.md](/README.md)' ,
58- ' [influxdb3_plugins/README.md](https://github.com/influxdata/influxdb3_plugins/blob/master/ README.md)'
71+ ` [influxdb3_plugins/README.md](${ rootUrl } README.md)`
5972 ) ;
6073
6174 return content ;
0 commit comments