feat: allow numbers in plugin ID ()

* fix example for id that didn't respect regex

example for id don't work with version 2.0.0-beta.15:
ValidationError: "id" with value "docs1" fails to match the required pattern: /^[a-zA-Z_-]+$/
Error: Process completed with exit code 1.

* properly fix

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Clement Demonchy 2022-02-11 04:57:58 +01:00 committed by GitHub
parent 10a5f71154
commit 1cd4757828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions
packages/docusaurus-utils-validation/src

View file

@ -11,7 +11,10 @@ import type {Tag} from '@docusaurus/utils';
import {JoiFrontMatter} from './JoiFrontMatter';
export const PluginIdSchema = Joi.string()
.regex(/^[a-zA-Z_-]+$/)
.regex(/^[a-zA-Z0-9_-]+$/)
.message(
'Illegal plugin ID value "{#value}": it should only contain alphanumerics, underscores, and dashes.',
)
.default(DEFAULT_PLUGIN_ID);
const MarkdownPluginsSchema = Joi.array()