feat(v2): add editUrl option to docs plugin (#1818)

* feat(v2): add editUrl option to docs plugin

* nits

* misc(v2): nit

* misc(v2): nit
This commit is contained in:
Endi 2019-10-11 02:10:18 +08:00 committed by Yangshun Tay
parent aba9edc12c
commit ae678c9dad
10 changed files with 66 additions and 6 deletions

View file

@ -18,6 +18,7 @@ export default async function processMetadata(
siteConfig: Partial<DocusaurusConfig>,
docsBasePath: string,
siteDir: string,
editUrl?: string,
): Promise<MetadataRaw> {
const filepath = path.join(docsDir, source);
@ -82,5 +83,9 @@ export default async function processMetadata(
}
}
if (editUrl) {
metadata.editUrl = normalizeUrl([editUrl, source]);
}
return metadata as MetadataRaw;
}