Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add docsRepo #155

Merged
merged 16 commits into from
Apr 23, 2018
2 changes: 2 additions & 0 deletions docs/default-theme-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ module.exports = {
themeConfig: {
// Assumes GitHub. Can also be a full GitLab url.
repo: 'vuejs/vuepress',
// Optional, your docs repo address, fallback to repo when it's not given.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults to `themeConfig.repo`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@egoist
Seems the same meaning

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is clearer if u specify themeConfig.repo

docsRepo: 'vuejs/vuepress',
// if your docs are not at the root of the repo
docsDir: 'docs',
// optional, defaults to master
Expand Down
4 changes: 3 additions & 1 deletion docs/zh/default-theme-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ module.exports = {
themeConfig: {
// 假定是 GitHub. 同时也可以是一个完整的 GitLab URL
repo: 'vuejs/vuepress',
// 当你的文档不是仓库的根目录时需要设置
   // 可选的,你的文档库的地址,如果没提供就会使用项目库的地址
   docsRepo: 'vuejs/vuepress',
   // 当你的文档不是仓库的根目录时需要设置
docsDir: 'docs',
// 可选的, 默认是 master
docsBranch: 'master',
Expand Down
11 changes: 6 additions & 5 deletions lib/default-theme/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,19 @@ export default {
docsDir = '',
docsBranch = 'master'
} = this.$site.themeConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add docsRepo = repo here seems clearer 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks



const docsRepo = this.$site.themeConfig.docsRepo || repo
let path = normalize(this.$page.path)
if (endingSlashRE.test(path)) {
path += 'README.md'
} else {
path += '.md'
}

if (repo && editLinks) {
const base = outboundRE.test(repo)
? repo
: `https://github.com/${repo}`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it just work for github?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can take a full URL to handle repositories

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it was preserved, I just changed the var name from repo to docsRepo.

if (docsRepo && editLinks) {
const base = outboundRE.test(docsRepo)
? docsRepo
: `https://github.com/${docsRepo}`
return (
base.replace(endingSlashRE, '') +
`/edit/${docsBranch}/` +
Expand Down