diff --git a/packages/@vuepress/theme-default/components/PageEdit.vue b/packages/@vuepress/theme-default/components/PageEdit.vue index 27db7f68fe..2c864950e1 100644 --- a/packages/@vuepress/theme-default/components/PageEdit.vue +++ b/packages/@vuepress/theme-default/components/PageEdit.vue @@ -68,6 +68,7 @@ export default { methods: { createEditLink (repo, docsRepo, docsDir, docsBranch, path) { const bitbucket = /bitbucket.org/ + const azurerepos = /dev\.azure\.com|\w+\.visualstudio\.com/ if (bitbucket.test(repo)) { const base = outboundRE.test(docsRepo) ? docsRepo : repo return ( @@ -80,6 +81,17 @@ export default { ) } + if (azurerepos.test(repo)) { + const base = outboundRE.test(docsRepo) ? docsRepo : repo + return ( + base.replace(endingSlashRE, '') + + `?path=` + + (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') + + path + + `&version=GBmaster` + ) + } + const base = outboundRE.test(docsRepo) ? docsRepo : `https://github.com/${docsRepo}` diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index 0ecc1a4437..2980c6ebac 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -414,7 +414,7 @@ next: false ## Git repository and Edit Links -Providing `themeConfig.repo` auto generates a GitHub link in the navbar and "Edit this page" links at the bottom of each page. +Providing `themeConfig.repo` auto generates a repository link in the navbar and "Edit this page" links at the bottom of each page. ``` js // .vuepress/config.js @@ -423,7 +423,7 @@ module.exports = { // Assumes GitHub. Can also be a full GitLab url. repo: 'vuejs/vuepress', // Customising the header label - // Defaults to "GitHub"/"GitLab"/"Bitbucket" depending on `themeConfig.repo` + // Defaults to "GitHub"/"GitLab"/"Bitbucket"/"Azure Repos" depending on `themeConfig.repo` repoLabel: 'Contribute!', // Optional options for generating "Edit this page" link