@@ -156,6 +156,19 @@ function buildProjectNavItems() {
156156 } ) ) ;
157157}
158158
159+ function buildEditLink ( { filePath } ) {
160+ const repoUrl = "https://github.com/BlueLua" ;
161+ const parts = filePath . split ( "/" ) ;
162+ const [ project , section , file ] = parts ;
163+
164+ if ( parts . length === 3 && section === "api" && file . endsWith ( ".md" ) ) {
165+ const stem = file . replace ( / \. m d $ / , "" ) ;
166+ return `${ repoUrl } /${ project } /edit/main/types/${ stem } .d.lua` ;
167+ }
168+
169+ return `${ repoUrl } /bluelua.github.io/edit/main/docs/src/${ filePath } ` ;
170+ }
171+
159172export default defineConfig ( {
160173 srcDir : "./src" ,
161174 title : "BlueLua" ,
@@ -220,21 +233,7 @@ export default defineConfig({
220233 } ,
221234 } ,
222235 } ,
223- editLink : {
224- pattern : ( { filePath } ) => {
225- const repoUrl = "https://github.com/BlueLua" ;
226- const parts = filePath . split ( "/" ) ;
227- const [ project , section , file ] = parts ;
228-
229- if ( parts . length === 3 && section === "api" && file . endsWith ( ".md" ) ) {
230- const stem = file . replace ( / \. m d $ / , "" ) ;
231- return `${ repoUrl } /${ project } /edit/main/types/${ stem } .d.lua` ;
232- }
233-
234- return `${ repoUrl } /bluelua.github.io/edit/main/docs/src/${ filePath } ` ;
235- } ,
236- text : "Edit this page" ,
237- } ,
236+ editLink : { pattern : buildEditLink } ,
238237 socialLinks : [ { icon : "github" , link : repoUrl } ] ,
239238 nav : [
240239 { text : "Home" , link : "/" } ,
0 commit comments