Skip to content

Commit 9d4c57b

Browse files
committed
fix: route API page edit links to definition files in types directory
1 parent 9dae6a3 commit 9d4c57b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

docs/.vitepress/config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,12 @@ function buildProjectNavItems() {
154154
}
155155

156156
function buildEditLink({ filePath }) {
157-
const repoUrl = "https://github.com/BlueLua";
158157
const [repo, ...rest] = filePath.split("/");
159-
return `${repoUrl}/${repo}/edit/main/docs/${rest.join("/")}`;
158+
const isApi = rest[0] === "api";
159+
const target = isApi
160+
? `types/${rest.slice(1).join("/").replace(/\.md$/, ".d.lua")}`
161+
: `docs/${rest.join("/")}`;
162+
return `https://github.com/BlueLua/${repo}/edit/main/${target}`;
160163
}
161164

162165
function filterSearchResult(result) {

0 commit comments

Comments
 (0)