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

@ -0,0 +1,31 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {
JoiFrontMatter as Joi,
validateFrontMatter,
} from '@docusaurus/utils-validation';
export type MDXFrontMatter = {
format: 'md' | 'mdx' | 'detect';
};
export const DefaultMDXFrontMatter: MDXFrontMatter = {
format: 'detect',
};
const MDXFrontMatterSchema = Joi.object<MDXFrontMatter>({
format: Joi.string()
.equal('md', 'mdx', 'detect')
.default(DefaultMDXFrontMatter.format),
}).default(DefaultMDXFrontMatter);
export function validateMDXFrontMatter(frontMatter: unknown): MDXFrontMatter {
return validateFrontMatter(frontMatter, MDXFrontMatterSchema, {
allowUnknown: false,
});
}