Skip to content

Commit

Permalink
🐛 fix: fix edit link
Browse files Browse the repository at this point in the history
  • Loading branch information
SigureMo committed Jun 12, 2023
1 parent 4b23ac4 commit 13ebd27
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ export default defineConfig({
description: '用可可爱爱的 canvas 动效装饰你的网页吧~',
themeConfig: {
editLink: {
pattern: 'https://github.com/moefyit/moefy-canvas/edit/main/docs/:path',
pattern: ({ filePath }) => {
const repoBase = 'https://github.com/moefyit/moefy-canvas/edit/main/'
if (filePath.startsWith('themes/')) {
if (filePath.endsWith('index.md')) {
return `${repoBase}README.md`
} else {
const theme = filePath.split('/')[1].split('.')[0]
return `${repoBase}packages/theme-${theme}/README.md`
}
} else {
return `${repoBase}docs/${filePath}`
}
},
text: 'Suggest changes to this page',
},

Expand Down

0 comments on commit 13ebd27

Please sign in to comment.