From 34e404fc956d14fb74669be04d54da9187fe4d43 Mon Sep 17 00:00:00 2001 From: ejuo Date: Fri, 1 Feb 2019 03:12:38 +0500 Subject: [PATCH] added support for link to custom repository. (#595) Added support for link to custom repository. Now the repository should have a known structure, although for direct link it is not necessary. --- packages/docz-core/src/utils/repo-info.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/docz-core/src/utils/repo-info.ts b/packages/docz-core/src/utils/repo-info.ts index 1a7c1cd57..db303ed12 100644 --- a/packages/docz-core/src/utils/repo-info.ts +++ b/packages/docz-core/src/utils/repo-info.ts @@ -20,12 +20,13 @@ export const getRepoUrl = () => { return ( repo && - repo.browsetemplate && - repo.browsetemplate - .replace('{domain}', repo.domain) - .replace('{user}', repo.user) - .replace('{project}', repo.project) - .replace('{/tree/committish}', '') + ((repo.browsetemplate && + repo.browsetemplate + .replace('{domain}', repo.domain) + .replace('{user}', repo.user) + .replace('{project}', repo.project) + .replace('{/tree/committish}', '')) || + (repo.browse && repo.browse())) ) }