feat: upgrade to MDX v2 (#8288)

Co-authored-by: Armano <armano2@users.noreply.github.com>
This commit is contained in:
Sébastien Lorber 2023-04-21 19:48:57 +02:00 committed by GitHub
parent 10f161d578
commit bf913aea2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 4028 additions and 2821 deletions

View file

@ -8,6 +8,7 @@
import logger from '@docusaurus/logger';
import Yaml from 'js-yaml';
import {PluginIdSchema} from './validationSchemas';
import type {ValidationOptions} from 'joi';
import type Joi from './Joi';
/** Print warnings returned from Joi validation. */
@ -77,13 +78,15 @@ export function normalizeThemeConfig<T>(
* Validate front matter with better error message
*/
export function validateFrontMatter<T>(
frontMatter: {[key: string]: unknown},
frontMatter: unknown,
schema: Joi.ObjectSchema<T>,
options?: ValidationOptions,
): T {
const {value, error, warning} = schema.validate(frontMatter, {
convert: true,
allowUnknown: true,
abortEarly: false,
...options,
});
printWarning(warning);