mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 08:42:31 +02:00
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:
parent
15c50e2ecb
commit
be7b5dca78
15 changed files with 368 additions and 69 deletions
|
@ -38,7 +38,7 @@ export const DEFAULT_OPTIONS: Omit<PluginOptions, 'id'> = {
|
|||
lastVersion: undefined,
|
||||
versions: {},
|
||||
editCurrentVersion: false,
|
||||
editLocalizedDocs: false,
|
||||
editLocalizedFiles: false,
|
||||
};
|
||||
|
||||
const VersionOptionsSchema = Joi.object({
|
||||
|
@ -52,9 +52,9 @@ const VersionsOptionsSchema = Joi.object()
|
|||
|
||||
export const OptionsSchema = Joi.object({
|
||||
path: Joi.string().default(DEFAULT_OPTIONS.path),
|
||||
editUrl: URISchema,
|
||||
editUrl: Joi.alternatives().try(URISchema, Joi.function()),
|
||||
editCurrentVersion: Joi.boolean().default(DEFAULT_OPTIONS.editCurrentVersion),
|
||||
editLocalizedDocs: Joi.boolean().default(DEFAULT_OPTIONS.editLocalizedDocs),
|
||||
editLocalizedFiles: Joi.boolean().default(DEFAULT_OPTIONS.editLocalizedFiles),
|
||||
routeBasePath: Joi.string()
|
||||
// '' not allowed, see https://github.com/facebook/docusaurus/issues/3374
|
||||
// .allow('') ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue