feat(v2): editUrl function for advanced use-cases (#4121)

* EditUrl function

* normalize blog/docs regarding the editUrl feature + editUrl function

* editUrl fn => always inject posix style relative paths, make tests more reliable
(see also https://github.com/facebook/docusaurus/issues/4124)

* fix editUrl on windows
This commit is contained in:
Sébastien Lorber 2021-01-29 15:35:25 +01:00 committed by GitHub
parent 15c50e2ecb
commit be7b5dca78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 368 additions and 69 deletions

View file

@ -211,6 +211,12 @@ function getVersionEditUrls({
return undefined;
}
// if the user is using the functional form of editUrl,
// he has total freedom and we can't compute a "version edit url"
if (typeof editUrl === 'function') {
return undefined;
}
const editDirPath = editCurrentVersion ? currentVersionPath : docsDirPath;
const editDirPathLocalized = editCurrentVersion
? getDocsDirPathLocalized({