mirror of
https://github.com/snowykami/mbcp.git
synced 2026-01-25 21:21:56 +00:00
📝 优化文档显示
This commit is contained in:
23
docs/.vitepress/config/utils.ts
Normal file
23
docs/.vitepress/config/utils.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* GetEditLink Options
|
||||
* @param text Edit link text
|
||||
*/
|
||||
export const ThemeConfig = {
|
||||
getEditLink: (editPageText: string): { pattern: (params: { filePath: string; }) => string; text: string; } => {
|
||||
return {
|
||||
pattern: ({filePath}: { filePath: string; }): string => {
|
||||
const regex = /^[^\/]+\/api/;
|
||||
if (regex.test(filePath)) {
|
||||
// remove {lang}/api prefix
|
||||
filePath = filePath.replace(regex, '')
|
||||
.replace('index.md', '__init__.py')
|
||||
.replace('.md', '.py');
|
||||
return `https://github.com/snowykami/mbcp/tree/main/mbcp/${filePath}`;
|
||||
} else {
|
||||
return `https://github.com/snowykami/mbcp/tree/main/docs/${filePath}`;
|
||||
}
|
||||
},
|
||||
text: editPageText
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user